mina????????????????
???????????? ???????[ 2013/4/15 10:48:23 ] ????????
????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);
}
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11