Search in sources :

Example 1 with CmppDeliverRequestMessage

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

the class TestCmppDeliverRequestMessageCodec method testchinesecode.

@Test
public void testchinesecode() {
    CmppDeliverRequestMessage msg = createTestReq("1234567890123456789中01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890");
    testlongCodec(msg);
}
Also used : CmppDeliverRequestMessage(com.zx.sms.codec.cmpp.msg.CmppDeliverRequestMessage) Test(org.junit.Test)

Example 2 with CmppDeliverRequestMessage

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

the class TestCmppDeliverRequestMessageCodec method testlongCodec.

public void testlongCodec(CmppDeliverRequestMessage msg) {
    channel().writeOutbound(msg);
    ByteBuf buf = (ByteBuf) channel().readOutbound();
    ByteBuf copybuf = Unpooled.buffer();
    while (buf != null) {
        copybuf.writeBytes(buf.copy());
        int length = buf.readableBytes();
        Assert.assertEquals(length, buf.readInt());
        Assert.assertEquals(msg.getPacketType().getCommandId(), buf.readInt());
        buf = (ByteBuf) channel().readOutbound();
    }
    CmppDeliverRequestMessage result = decode(copybuf);
    System.out.println(result.getMsgContent());
    Assert.assertEquals(msg.getMsgContent(), result.getMsgContent());
}
Also used : CmppDeliverRequestMessage(com.zx.sms.codec.cmpp.msg.CmppDeliverRequestMessage) ByteBuf(io.netty.buffer.ByteBuf)

Example 3 with CmppDeliverRequestMessage

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

the class TestCmppDeliverRequestMessageCodec method testCodec.

@Test
public void testCodec() {
    CmppDeliverRequestMessage msg = createTestReq("ad3 中");
    test0(msg);
}
Also used : CmppDeliverRequestMessage(com.zx.sms.codec.cmpp.msg.CmppDeliverRequestMessage) Test(org.junit.Test)

Example 4 with CmppDeliverRequestMessage

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

the class TestCmppDeliverRequestMessageCodec method testReportCodec.

@Test
public void testReportCodec() {
    CmppDeliverRequestMessage msg = createTestReq("k k k ");
    msg.setMsgContent((SmsMessage) null);
    CmppReportRequestMessage reportRequestMessage = new CmppReportRequestMessage();
    reportRequestMessage.setSmscSequence(0x1234L);
    reportRequestMessage.setMsgId(new MsgId());
    reportRequestMessage.setDestterminalId("13800138000");
    reportRequestMessage.setStat("9876");
    msg.setReportRequestMessage(reportRequestMessage);
    test0(msg);
}
Also used : CmppDeliverRequestMessage(com.zx.sms.codec.cmpp.msg.CmppDeliverRequestMessage) CmppReportRequestMessage(com.zx.sms.codec.cmpp.msg.CmppReportRequestMessage) MsgId(com.zx.sms.common.util.MsgId) Test(org.junit.Test)

Example 5 with CmppDeliverRequestMessage

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

the class TestCmppDeliverRequestMessageCodec method testSLPUSH.

@Test
public void testSLPUSH() {
    CmppDeliverRequestMessage msg = createTestReq("");
    WapSLPush sl = new WapSLPush("http://www.baidu.com");
    SmsMessage wap = new SmsWapPushMessage(sl);
    msg.setMsgContent(wap);
    CmppDeliverRequestMessage result = testWapCodec(msg);
    SmsWapPushMessage smsmsg = (SmsWapPushMessage) result.getSmsMessage();
    WapSLPush actsl = (WapSLPush) smsmsg.getWbxml();
    Assert.assertEquals(sl.getUri(), actsl.getUri());
}
Also used : SmsWapPushMessage(org.marre.wap.push.SmsWapPushMessage) CmppDeliverRequestMessage(com.zx.sms.codec.cmpp.msg.CmppDeliverRequestMessage) SmsMessage(org.marre.sms.SmsMessage) WapSLPush(org.marre.wap.push.WapSLPush) Test(org.junit.Test)

Aggregations

CmppDeliverRequestMessage (com.zx.sms.codec.cmpp.msg.CmppDeliverRequestMessage)41 Test (org.junit.Test)23 ByteBuf (io.netty.buffer.ByteBuf)18 CmppReportRequestMessage (com.zx.sms.codec.cmpp.msg.CmppReportRequestMessage)8 MsgId (com.zx.sms.common.util.MsgId)7 SmsMessage (org.marre.sms.SmsMessage)6 SmsWapPushMessage (org.marre.wap.push.SmsWapPushMessage)4 CmppSubmitRequestMessage (com.zx.sms.codec.cmpp.msg.CmppSubmitRequestMessage)3 DefaultHeader (com.zx.sms.codec.cmpp.msg.DefaultHeader)3 Header (com.zx.sms.codec.cmpp.msg.Header)3 SmsDcs (org.marre.sms.SmsDcs)3 CmppDeliverResponseMessage (com.zx.sms.codec.cmpp.msg.CmppDeliverResponseMessage)2 CmppQueryRequestMessage (com.zx.sms.codec.cmpp.msg.CmppQueryRequestMessage)2 CmppQueryResponseMessage (com.zx.sms.codec.cmpp.msg.CmppQueryResponseMessage)2 CmppSubmitResponseMessage (com.zx.sms.codec.cmpp.msg.CmppSubmitResponseMessage)2 SmsMmsNotificationMessage (org.marre.wap.push.SmsMmsNotificationMessage)2 WapSIPush (org.marre.wap.push.WapSIPush)2 WapSLPush (org.marre.wap.push.WapSLPush)2 EndpointEntity (com.zx.sms.connect.manager.EndpointEntity)1 ServerEndpoint (com.zx.sms.connect.manager.ServerEndpoint)1