/** 处理普通消息 */
 public void packetDispatch(ByteBuf byteBuf) throws InvalidProtocolBufferException {
   DataBuffer dataBuffer = new DataBuffer(byteBuf);
   Header header = dataBuffer.getHeader();
   byte[] body = dataBuffer.getBodyData();
   short commandId = header.getCommandId();
   short serviceId = header.getServiceId();
   Packetlistener packetlistener = listenerQueue.pop(header.getSeqnum());
   // logger.e("****ServerMessagePacketDispatch1111");
   if (packetlistener != null) {
     // logger.e("****ServerMessagePacketDispatch2222");
     packetlistener.onSuccess(serviceId, body);
   }
   switch (commandId) {
     case SysConstant.CMD_HEART:
       // DiscardHeart
       logger.e("****HEART_MESSAGE");
       break;
     case SysConstant.CMD_FILE_NEW:
     case SysConstant.CMD_TASK_CHECK:
     case SysConstant.CMD_FILE_RESUME:
     case SysConstant.CMD_FILE_RESUME_REMOTE:
     case SysConstant.CMD_FILE_CANCEL:
       IMFileManager.getInstance().dispatchMessage(header, body);
       break;
   }
 }
 /** 处理认证消息 */
 public void packetDispatchAuth(ChannelHandlerContext ctx, ByteBuf msg) {
   DataBuffer dataBuffer = new DataBuffer(msg);
   Header header = dataBuffer.getHeader();
   byte[] body = dataBuffer.getBodyData();
   short commandId = header.getCommandId();
   switch (commandId) {
     case SysConstant.CMD_SHAKE_HAND:
       logger.e("****ServerMessage-DispatchShakeHand");
       ShakeHand(ctx, body, header.getSeqnum());
       break;
     case SysConstant.CMD_HEART:
       // DiscardHeart
       logger.e("****HEART_MESSAGE");
       break;
   }
 }
 public void sendMessage(
     ChannelHandlerContext ctx,
     short serviceId,
     short commandId,
     GeneratedMessage msg,
     Packetlistener packetlistener,
     short seqnum) {
   if (ctx != null) {
     Header header = new Header();
     header.setCommandId(commandId);
     header.setServiceId(serviceId);
     if (seqnum != 0) {
       header.setSeqnum(seqnum);
     }
     if (packetlistener != null && seqnum == 0) {
       short reqSeqnum = header.getSeqnum();
       listenerQueue.push(reqSeqnum, packetlistener);
     }
     header.setLength(SysConstant.HEADER_LENGTH + msg.getSerializedSize());
     messageServerThread.sendMessage(ctx, header, msg);
   }
 }