diff --git a/weixin4j-server/src/main/java/com/foxinmy/weixin4j/startup/WeixinServerBootstrap.java b/weixin4j-server/src/main/java/com/foxinmy/weixin4j/startup/WeixinServerBootstrap.java
index cd0188ad..d7e14a79 100644
--- a/weixin4j-server/src/main/java/com/foxinmy/weixin4j/startup/WeixinServerBootstrap.java
+++ b/weixin4j-server/src/main/java/com/foxinmy/weixin4j/startup/WeixinServerBootstrap.java
@@ -147,7 +147,6 @@ public final class WeixinServerBootstrap {
new WeixinServerInitializer(aesToken,
messageDispatcher));
Channel ch = b.bind(serverPort).sync().channel();
- System.err.println("weixin4j server startup OK:" + serverPort);
logger.info("weixin4j server startup OK:{}", serverPort);
ch.closeFuture().sync();
} catch (WeixinException e) {
diff --git a/weixin4j-server/src/test/java/com/foxinmy/weixin4j/server/test/EncryptMessageTest.java b/weixin4j-server/src/test/java/com/foxinmy/weixin4j/server/test/EncryptMessageTest.java
index c63e55dd..a5b9d16e 100644
--- a/weixin4j-server/src/test/java/com/foxinmy/weixin4j/server/test/EncryptMessageTest.java
+++ b/weixin4j-server/src/test/java/com/foxinmy/weixin4j/server/test/EncryptMessageTest.java
@@ -24,9 +24,9 @@ public class EncryptMessageTest extends MessagePush {
*/
@Test
public void testValidate() throws IOException {
- String echostr = "2143641595566077626";
- String para = "?signature=0d2366aedb4f3531cfa4297c1e4ea7eece2311d9&echostr="
- + echostr + "×tamp=1415951914&nonce=165976363";
+ String echostr = "9104940990866104523";
+ String para = "?signature=6ea29ec4c087868f960a20f28b7ac3edef7e444e&echostr="
+ + echostr + "×tamp=1433903307&nonce=1961697383";
xmlSb.delete(0, xmlSb.length());
String response = get(para);
Assert.assertEquals(echostr, response);
@@ -39,15 +39,14 @@ public class EncryptMessageTest extends MessagePush {
*/
@Test
public void testType1() throws IOException {
- String para = "?signature=6dd806a20a314723e78bc58742a1b98a7adfd151×tamp=1415979366&nonce=1865915590";
+ String para = "?signature=d919cc8a6361597afa536e906156262cc9cd93df×tamp=1433903433&nonce=518016546";
xmlSb.delete(0, xmlSb.length());
xmlSb.append("");
- xmlSb.append("");
- xmlSb.append("");
- xmlSb.append("1415979365");
- xmlSb.append("");
- xmlSb.append("");
- xmlSb.append("");
+ xmlSb.append("");
+ xmlSb.append("");
+ xmlSb.append("1433903433");
+ xmlSb.append("");
+ xmlSb.append("");
xmlSb.append("");
String response = push(para, xmlSb.toString());
Assert.assertNotNull(response);
diff --git a/weixin4j-server/src/test/java/com/foxinmy/weixin4j/server/test/EventMessageRequestTest.java b/weixin4j-server/src/test/java/com/foxinmy/weixin4j/server/test/EventMessageRequestTest.java
index a0bd9bf1..2498595a 100644
--- a/weixin4j-server/src/test/java/com/foxinmy/weixin4j/server/test/EventMessageRequestTest.java
+++ b/weixin4j-server/src/test/java/com/foxinmy/weixin4j/server/test/EventMessageRequestTest.java
@@ -19,6 +19,7 @@ public class EventMessageRequestTest extends MessagePush {
/***************** event message *********************/
@Test
public void scribe() throws IOException {
+ String para = "?signature=d919cc8a6361597afa536e906156262cc9cd93df×tamp=1433903433&nonce=518016546";
xmlSb.delete(0, xmlSb.length());
xmlSb.append("");
xmlSb.append("");
@@ -27,13 +28,14 @@ public class EventMessageRequestTest extends MessagePush {
xmlSb.append("");
xmlSb.append("");
xmlSb.append("");
- String response = push(xmlSb.toString());
+ String response = push(para, xmlSb.toString());
Assert.assertNotNull(response);
System.out.println(response);
}
@Test
public void scan() throws IOException {
+ String para = "?signature=d919cc8a6361597afa536e906156262cc9cd93df×tamp=1433903433&nonce=518016546";
xmlSb.delete(0, xmlSb.length());
xmlSb.append("");
xmlSb.append("");
@@ -44,13 +46,14 @@ public class EventMessageRequestTest extends MessagePush {
xmlSb.append("");
xmlSb.append("");
xmlSb.append("");
- String response = push(xmlSb.toString());
+ String response = push(para, xmlSb.toString());
Assert.assertNotNull(response);
System.out.println(response);
}
@Test
public void scan_scribe() throws IOException {
+ String para = "?signature=d919cc8a6361597afa536e906156262cc9cd93df×tamp=1433903433&nonce=518016546";
xmlSb.delete(0, xmlSb.length());
xmlSb.append("");
xmlSb.append("");
@@ -60,13 +63,14 @@ public class EventMessageRequestTest extends MessagePush {
xmlSb.append("");
xmlSb.append("");
xmlSb.append("");
- String response = push(xmlSb.toString());
+ String response = push(para, xmlSb.toString());
Assert.assertNotNull(response);
System.out.println(response);
}
@Test
public void location() throws IOException {
+ String para = "?signature=d919cc8a6361597afa536e906156262cc9cd93df×tamp=1433903433&nonce=518016546";
xmlSb.delete(0, xmlSb.length());
xmlSb.append("");
xmlSb.append("");
@@ -78,13 +82,14 @@ public class EventMessageRequestTest extends MessagePush {
xmlSb.append("113.352425");
xmlSb.append("119.385040");
xmlSb.append("");
- String response = push(xmlSb.toString());
+ String response = push(para, xmlSb.toString());
Assert.assertNotNull(response);
System.out.println(response);
}
@Test
public void menu_click() throws IOException {
+ String para = "?signature=d919cc8a6361597afa536e906156262cc9cd93df×tamp=1433903433&nonce=518016546";
xmlSb.delete(0, xmlSb.length());
xmlSb.append("");
xmlSb.append("");
@@ -94,13 +99,14 @@ public class EventMessageRequestTest extends MessagePush {
xmlSb.append("");
xmlSb.append("");
xmlSb.append("");
- String response = push(xmlSb.toString());
+ String response = push(para, xmlSb.toString());
Assert.assertNotNull(response);
System.out.println(response);
}
@Test
public void menu_link() throws IOException {
+ String para = "?signature=d919cc8a6361597afa536e906156262cc9cd93df×tamp=1433903433&nonce=518016546";
xmlSb.delete(0, xmlSb.length());
xmlSb.append("");
xmlSb.append("");
@@ -110,13 +116,14 @@ public class EventMessageRequestTest extends MessagePush {
xmlSb.append("");
xmlSb.append("");
xmlSb.append("");
- String response = push(xmlSb.toString());
+ String response = push(para, xmlSb.toString());
Assert.assertNotNull(response);
System.out.println(response);
}
@Test
public void menu_scan() throws IOException {
+ String para = "?signature=d919cc8a6361597afa536e906156262cc9cd93df×tamp=1433903433&nonce=518016546";
xmlSb.delete(0, xmlSb.length());
xmlSb.append("");
xmlSb.append("");
@@ -130,13 +137,14 @@ public class EventMessageRequestTest extends MessagePush {
xmlSb.append("");
xmlSb.append("");
- String response = push(xmlSb.toString());
+ String response = push(para, xmlSb.toString());
Assert.assertNotNull(response);
System.out.println(response);
}
@Test
public void menu_photo() throws IOException {
+ String para = "?signature=d919cc8a6361597afa536e906156262cc9cd93df×tamp=1433903433&nonce=518016546";
xmlSb.delete(0, xmlSb.length());
xmlSb.append("");
xmlSb.append("");
@@ -149,13 +157,14 @@ public class EventMessageRequestTest extends MessagePush {
xmlSb.append("- ");
xmlSb.append("
");
xmlSb.append("");
- String response = push(xmlSb.toString());
+ String response = push(para, xmlSb.toString());
Assert.assertNotNull(response);
System.out.println(response);
}
@Test
public void menu_location() throws IOException {
+ String para = "?signature=d919cc8a6361597afa536e906156262cc9cd93df×tamp=1433903433&nonce=518016546";
xmlSb.delete(0, xmlSb.length());
xmlSb.append("");
xmlSb.append("");
@@ -170,7 +179,7 @@ public class EventMessageRequestTest extends MessagePush {
xmlSb.append("");
xmlSb.append("");
xmlSb.append("");
- String response = push(xmlSb.toString());
+ String response = push(para, xmlSb.toString());
Assert.assertNotNull(response);
System.out.println(response);
}
diff --git a/weixin4j-server/src/test/java/com/foxinmy/weixin4j/server/test/MessageRequestTest.java b/weixin4j-server/src/test/java/com/foxinmy/weixin4j/server/test/MessageRequestTest.java
index d8a398b0..ba1fc67e 100644
--- a/weixin4j-server/src/test/java/com/foxinmy/weixin4j/server/test/MessageRequestTest.java
+++ b/weixin4j-server/src/test/java/com/foxinmy/weixin4j/server/test/MessageRequestTest.java
@@ -20,6 +20,7 @@ public class MessageRequestTest extends MessagePush {
@Test
public void text() throws IOException {
+ String para = "?signature=d919cc8a6361597afa536e906156262cc9cd93df×tamp=1433903433&nonce=518016546";
xmlSb.delete(0, xmlSb.length());
xmlSb.append("");
xmlSb.append("");
@@ -29,13 +30,14 @@ public class MessageRequestTest extends MessagePush {
xmlSb.append("");
xmlSb.append("1234567890123456");
xmlSb.append("");
- String response = push(xmlSb.toString());
+ String response = push(para, xmlSb.toString());
Assert.assertNotNull(response);
System.out.println(response);
}
@Test
public void image() throws IOException {
+ String para = "?signature=d919cc8a6361597afa536e906156262cc9cd93df×tamp=1433903433&nonce=518016546";
xmlSb.delete(0, xmlSb.length());
xmlSb.append("");
xmlSb.append("");
@@ -46,13 +48,14 @@ public class MessageRequestTest extends MessagePush {
xmlSb.append("");
xmlSb.append("1234567890123456");
xmlSb.append("");
- String response = push(xmlSb.toString());
+ String response = push(para, xmlSb.toString());
Assert.assertNotNull(response);
System.out.println(response);
}
@Test
public void voice() throws IOException {
+ String para = "?signature=d919cc8a6361597afa536e906156262cc9cd93df×tamp=1433903433&nonce=518016546";
xmlSb.delete(0, xmlSb.length());
xmlSb.append("");
xmlSb.append("");
@@ -63,13 +66,14 @@ public class MessageRequestTest extends MessagePush {
xmlSb.append("");
xmlSb.append("1234567890123456");
xmlSb.append("");
- String response = push(xmlSb.toString());
+ String response = push(para, xmlSb.toString());
Assert.assertNotNull(response);
System.out.println(response);
}
@Test
public void re_voice() throws IOException {
+ String para = "?signature=d919cc8a6361597afa536e906156262cc9cd93df×tamp=1433903433&nonce=518016546";
xmlSb.delete(0, xmlSb.length());
xmlSb.append("");
xmlSb.append("");
@@ -81,13 +85,14 @@ public class MessageRequestTest extends MessagePush {
xmlSb.append("");
xmlSb.append("1234567890123456");
xmlSb.append("");
- String response = push(xmlSb.toString());
+ String response = push(para, xmlSb.toString());
Assert.assertNotNull(response);
System.out.println(response);
}
@Test
public void video() throws IOException {
+ String para = "?signature=d919cc8a6361597afa536e906156262cc9cd93df×tamp=1433903433&nonce=518016546";
xmlSb.delete(0, xmlSb.length());
xmlSb.append("");
xmlSb.append("");
@@ -98,13 +103,14 @@ public class MessageRequestTest extends MessagePush {
xmlSb.append("");
xmlSb.append("1234567890123456");
xmlSb.append("");
- String response = push(xmlSb.toString());
+ String response = push(para, xmlSb.toString());
Assert.assertNotNull(response);
System.out.println(response);
}
@Test
public void location() throws IOException {
+ String para = "?signature=d919cc8a6361597afa536e906156262cc9cd93df×tamp=1433903433&nonce=518016546";
xmlSb.delete(0, xmlSb.length());
xmlSb.append("");
xmlSb.append("");
@@ -117,13 +123,14 @@ public class MessageRequestTest extends MessagePush {
xmlSb.append("");
xmlSb.append("1234567890123456");
xmlSb.append("");
- String response = push(xmlSb.toString());
+ String response = push(para, xmlSb.toString());
Assert.assertNotNull(response);
System.out.println(response);
}
@Test
public void link() throws IOException {
+ String para = "?signature=d919cc8a6361597afa536e906156262cc9cd93df×tamp=1433903433&nonce=518016546";
xmlSb.delete(0, xmlSb.length());
xmlSb.append("");
xmlSb.append("");
@@ -135,7 +142,7 @@ public class MessageRequestTest extends MessagePush {
xmlSb.append("");
xmlSb.append("1234567890123456");
xmlSb.append("");
- String response = push(xmlSb.toString());
+ String response = push(para, xmlSb.toString());
Assert.assertNotNull(response);
System.out.println(response);
}
diff --git a/weixin4j-server/src/test/java/com/foxinmy/weixin4j/server/test/MessageServerStartup.java b/weixin4j-server/src/test/java/com/foxinmy/weixin4j/server/test/MessageServerStartup.java
index 62b4d202..acfa122f 100644
--- a/weixin4j-server/src/test/java/com/foxinmy/weixin4j/server/test/MessageServerStartup.java
+++ b/weixin4j-server/src/test/java/com/foxinmy/weixin4j/server/test/MessageServerStartup.java
@@ -15,9 +15,9 @@ import com.foxinmy.weixin4j.response.WeixinResponse;
import com.foxinmy.weixin4j.startup.WeixinServerBootstrap;
/**
- * 服务启动
+ * 服务启动测试类
*
- * @className ServerStarup
+ * @className MessageServerStartup
* @author jy
* @date 2015年5月7日
* @since JDK 1.7
@@ -25,9 +25,12 @@ import com.foxinmy.weixin4j.startup.WeixinServerBootstrap;
*/
public class MessageServerStartup {
- final String appid = "appid";
- final String token = "carsonliu13450438112";
- final String aesKey = "AES密钥";
+ // 应用ID
+ final String appid = "wx4ab8f8de58159a57";
+ // 开发者token
+ final String token = "weixin4j";
+ // AES密钥(安全模式)
+ final String aesKey = "";
/**
* 明文模式
@@ -109,6 +112,6 @@ public class MessageServerStartup {
}
public static void main(String[] args) throws Exception {
- new MessageServerStartup().test3();
+ new MessageServerStartup().test1();
}
}