This commit is contained in:
jinyu 2016-11-02 22:38:59 +08:00
parent d3554f0f70
commit ee2261d56a
3 changed files with 4 additions and 5 deletions

View File

@ -29,7 +29,7 @@ public class WeixinServerInitializer extends ChannelInitializer<SocketChannel> {
public WeixinServerInitializer(Map<String, AesToken> aesTokenMap, public WeixinServerInitializer(Map<String, AesToken> aesTokenMap,
WeixinMessageDispatcher messageDispatcher) { WeixinMessageDispatcher messageDispatcher) {
this.messageDispatcher = messageDispatcher; this.messageDispatcher = messageDispatcher;
messageDecoder = new WeixinMessageDecoder(aesTokenMap); this.messageDecoder = new WeixinMessageDecoder(aesTokenMap);
} }
public int addAesToken(final AesToken asetoken){ public int addAesToken(final AesToken asetoken){

View File

@ -95,7 +95,7 @@ public final class WeixinServerBootstrap {
* *
*/ */
public WeixinServerBootstrap(String token) { public WeixinServerBootstrap(String token) {
this(null, token, null); this("", token, null);
} }
/** /**
@ -163,7 +163,7 @@ public final class WeixinServerBootstrap {
for (AesToken aesToken : aesTokens) { for (AesToken aesToken : aesTokens) {
this.aesTokenMap.put(aesToken.getWeixinId(), aesToken); this.aesTokenMap.put(aesToken.getWeixinId(), aesToken);
} }
this.aesTokenMap.put(null, aesTokens[0]); this.aesTokenMap.put("", aesTokens[0]);
this.messageHandlerList = new ArrayList<WeixinMessageHandler>(); this.messageHandlerList = new ArrayList<WeixinMessageHandler>();
this.messageInterceptorList = new ArrayList<WeixinMessageInterceptor>(); this.messageInterceptorList = new ArrayList<WeixinMessageInterceptor>();
this.messageDispatcher = new WeixinMessageDispatcher(messageMatcher); this.messageDispatcher = new WeixinMessageDispatcher(messageMatcher);
@ -205,7 +205,6 @@ public final class WeixinServerBootstrap {
EventLoopGroup bossGroup = new NioEventLoopGroup(bossThreads); EventLoopGroup bossGroup = new NioEventLoopGroup(bossThreads);
EventLoopGroup workerGroup = new NioEventLoopGroup(workerThreads); EventLoopGroup workerGroup = new NioEventLoopGroup(workerThreads);
try { try {
wechatInitializer = new WeixinServerInitializer(aesTokenMap, wechatInitializer = new WeixinServerInitializer(aesTokenMap,
messageDispatcher); messageDispatcher);
ServerBootstrap b = new ServerBootstrap(); ServerBootstrap b = new ServerBootstrap();

View File

@ -167,6 +167,6 @@ public class MessageServerStartup {
* @throws Exception * @throws Exception
*/ */
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
new MessageServerStartup().test2(); new MessageServerStartup().test1();
} }
} }