Search in sources :

Example 6 with CmppActiveTestRequestMessage

use of com.zx.sms.codec.cmpp.msg.CmppActiveTestRequestMessage in project SMSGate by Lihuanghe.

the class TestCmppActiveTestRequestMessageCodec method testCodec.

@Test
public void testCodec() {
    CmppActiveTestRequestMessage msg = createMsg();
    ByteBuf buf = encode(msg);
    ByteBuf copybuf = buf.copy();
    Assert.assertEquals(12, buf.readableBytes());
    Assert.assertEquals(12, buf.readInt());
    Assert.assertEquals(msg.getPacketType().getCommandId(), buf.readInt());
    Assert.assertEquals(msg.getHeader().getSequenceId(), buf.readInt());
    CmppActiveTestRequestMessage result = decode(copybuf);
    Assert.assertTrue(result instanceof CmppActiveTestRequestMessage);
    Assert.assertEquals(msg.getHeader().getSequenceId(), ((CmppActiveTestRequestMessage) result).getHeader().getSequenceId());
    System.out.println(msg.getHeader());
}
Also used : CmppActiveTestRequestMessage(com.zx.sms.codec.cmpp.msg.CmppActiveTestRequestMessage) ByteBuf(io.netty.buffer.ByteBuf) Test(org.junit.Test)

Aggregations

CmppActiveTestRequestMessage (com.zx.sms.codec.cmpp.msg.CmppActiveTestRequestMessage)6 Test (org.junit.Test)2 DefaultHeader (com.zx.sms.codec.cmpp.msg.DefaultHeader)1 Header (com.zx.sms.codec.cmpp.msg.Header)1 VersionObject (com.zx.sms.common.storedMap.VersionObject)1 ByteBuf (io.netty.buffer.ByteBuf)1 IdleStateEvent (io.netty.handler.timeout.IdleStateEvent)1 File (java.io.File)1 Serializable (java.io.Serializable)1 Map (java.util.Map)1 DB (org.iq80.leveldb.DB)1 DBIterator (org.iq80.leveldb.DBIterator)1 Options (org.iq80.leveldb.Options)1 ReadOptions (org.iq80.leveldb.ReadOptions)1