Package com.cloudhopper.smpp.transcoder

Examples of com.cloudhopper.smpp.transcoder.PduTranscoderContext


    @Override
    public void childChannelOpen(ChannelHandlerContext ctx, ChildChannelStateEvent e) throws Exception {
        logger.info("childChannelOpen: {}", e);

        // modify its pipeline
        PduTranscoderContext context = new DefaultPduTranscoderContext();
        PduTranscoder transcoder = new DefaultPduTranscoder(context);

        // create a new "smsc" session instance (which is just a handler)
        SmppSimulatorSessionHandler session = new SmppSimulatorSessionHandler(e.getChildChannel(), transcoder);
View Full Code Here


    }

    @Test
    public void parseRealWorldReceipt0() throws Exception {

        PduTranscoderContext context = new DefaultPduTranscoderContext();
        PduTranscoder transcoder = new DefaultPduTranscoder(context);

        ChannelBuffer buffer0 = BufferHelper.createBuffer("000000BA00000005000000000000000200010134343935313336313932300001013430343034000400000000000000006E69643A30303539313133393738207375623A30303120646C7672643A303031207375626D697420646174653A3130303231303137333020646F6E6520646174653A3130303231303137333120737461743A44454C49565244206572723A30303020746578743A4024232125262F3A000E0001010006000101001E000833383630316661000427000102");

        DeliverSm pdu0 = (DeliverSm)transcoder.decode(buffer0);
View Full Code Here

        Assert.assertEquals(message0, receipt0);
    }

    @Test
    public void parseReceiptWithTimestampIncludingSeconds() throws Exception {
        PduTranscoderContext context = new DefaultPduTranscoderContext();
        PduTranscoder transcoder = new DefaultPduTranscoder(context);

        DeliveryReceipt dlr = DeliveryReceipt.parseShortMessage("id:74e02ee1-4e2f-4a6e-a78b-4b247d756a22 sub:001 dlvrd:001 submit date:110206193041 done date:110206193110 stat:DELIVRD err:000 text:", DateTimeZone.UTC);

        Assert.assertEquals("74e02ee1-4e2f-4a6e-a78b-4b247d756a22", dlr.getMessageId());
View Full Code Here

        Assert.assertNull(dlr.getText());
    }

    @Test
    public void parseReceiptWithFieldsOutOfOrder() throws Exception {
        PduTranscoderContext context = new DefaultPduTranscoderContext();
        PduTranscoder transcoder = new DefaultPduTranscoder(context);
        DeliveryReceipt dlr = DeliveryReceipt.parseShortMessage("sub:001 id:74e02ee1-4e2f-4a6e-a78b-4b247d756a22 err:000 dlvrd:001 done date:110206193110 submit date:110206193041 text: stat:DELIVRD", DateTimeZone.UTC);
        Assert.assertEquals("74e02ee1-4e2f-4a6e-a78b-4b247d756a22", dlr.getMessageId());
        Assert.assertEquals(1, dlr.getSubmitCount());
        Assert.assertEquals(1, dlr.getDeliveredCount());
View Full Code Here

        Assert.assertEquals(98765432101L, DeliveryReceipt.toMessageIdAsLong("16fee0e525"));
    }

    @Test
    public void parseReceiptWithMissingSubAndDlvrdFields() throws Exception {
        PduTranscoderContext context = new DefaultPduTranscoderContext();
        PduTranscoder transcoder = new DefaultPduTranscoder(context);
        DeliveryReceipt dlr = DeliveryReceipt.parseShortMessage("id:2E179B310EDE971B2760C72B7F026E1B submit date:20110314181534 done date:20110314181741 stat:DELIVRD err:0", DateTimeZone.UTC, false);
        Assert.assertEquals("2E179B310EDE971B2760C72B7F026E1B", dlr.getMessageId());
        Assert.assertEquals(-1, dlr.getSubmitCount());
        Assert.assertEquals(-1, dlr.getDeliveredCount());
View Full Code Here

*/
public class ParserMain {
    private static final Logger logger = LoggerFactory.getLogger(ParserMain.class);

    static public void main(String[] args) throws Exception {
        PduTranscoderContext context = new DefaultPduTranscoderContext();
        PduTranscoder transcoder = new DefaultPduTranscoder(context);
        ChannelBuffer buffer = BufferHelper.createBuffer("000000420000000400000000000000030001003633393238383032000101343439353133363139323035004000000000000000000774657374323232020B00020D05");
        Pdu pdu = transcoder.decode(buffer);
        logger.debug("{}", pdu);
    }
View Full Code Here

TOP

Related Classes of com.cloudhopper.smpp.transcoder.PduTranscoderContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.