????3?????????????????д?????????????????

public class ClientDecoder extends CumulativeProtocolDecoder {
 public static Logger logger = Logger.getLogger(ClientDecoder.class);
 @Override
 protected boolean doDecode(IoSession session?? IoBuffer in??
   ProtocolDecoderOutput out) throws Exception {
  IoBuffer buf = IoBuffer.allocate(0).setAutoExpand(true);
  IoBuffer buffer = IoBuffer.allocate(0).setAutoExpand(true);
  byte [] head = new byte[16];
  logger.info(in.remaining());
  if (in.remaining() > 0) {
   int msgLen = 16;// 16????ж????????
   if (in.remaining() > msgLen) {
    in.mark();   
    in.get(head?? 0?? 16);   
    buf.put(XorParamCodec.decryptXOR(head));
    buf.flip();
    int length=buf.getInt();
    if (length - msgLen > in.remaining()) {
     in.reset();
     return false;
    } else {
     in.position(0);
     while (in.hasRemaining()) {
      buffer.put(in.get());
     }
     buffer.flip();
     out.write(buffer);
     return false;
    }
   }
  }
  return false;
 }

}

????4????дTest????????

@Before
 public void beforeTest() {
  ip = PropertiesHandle.readValue("ip");
  port = Integer.valueOf(PropertiesHandle.readValue("port"));
  mmc = new MyMinaClient();
 }
 
 @Test
 public void testUpdate() throws Exception {

  IoConnector connector = mmc.creatClient();
  IoSession session = mmc.getIoSession(connector?? ip?? port);
  mmc.sendMsg(session?? ClientRegister.getRegisterInfo()); \ClientRegister??ClientUpdate????????????????
            mmc.sendMsg(session?? ClientUpdate.getUpdateInfo());
  mmc.close(session?? connector);
  Assert.assertEquals(AcctGuardData.Registerr_Rec?? HeaderInfo.response);
 }