Package ie.omk.smpp.message

Examples of ie.omk.smpp.message.SMPPPacket


        }
      }

    }).start();

    SMPPPacket packet = connection.readNextPacket();
    Assert.assertNotNull(packet);
    Assert.assertEquals(packet.getCommandId(), SMPPPacket.DELIVER_SM);

    DeliverSM deliverSm = (DeliverSM) packet;
    Assert.assertEquals(deliverSm.getEsmClass(), (byte) 0);
    Assert.assertEquals(deliverSm.getSource().getAddress(), "2222");
    Assert.assertEquals(deliverSm.getDestination().getAddress(), "1111");
View Full Code Here


        }
      }

    }).start();

    SMPPPacket packet = connection.readNextPacket();
    Assert.assertNotNull(packet);
    Assert.assertEquals(packet.getCommandId(), SMPPPacket.DELIVER_SM);

    DeliverSM deliverSm = (DeliverSM) packet;
    Assert.assertEquals(deliverSm.getEsmClass(), (byte) 0x04);
    Assert.assertEquals(deliverSm.getSource().getAddress(), "2222");
    Assert.assertEquals(deliverSm.getDestination().getAddress(), "1111");
View Full Code Here

     */
    protected SMPPResponse waitForResponsePacket(SMPPPacket req)
            throws java.net.SocketTimeoutException, java.io.IOException,
            SMPPProtocolException {
        try {
            SMPPPacket resp = null;

            int expectedSeq = req.getSequenceNum();
            while (true) {
                resp = readNextPacketInternal();
                if (!resp.isRequest()
                        && resp.getSequenceNum() == expectedSeq) {
                    break;
                } else {
                    LOGGER.info("Queuing unexpected sequence numbered packet.");
                    if (LOGGER.isDebugEnabled()) {
                        StringBuffer err = new StringBuffer("Expected:")
                        .append(expectedSeq).append(" but got ")
                        .append(resp.getSequenceNum()).append(" type: 0x")
                        .append(Integer.toHexString(resp.getCommandId()));
                        LOGGER.debug(err.toString());
                    }
                    packetQueue.add(resp);
                }
            }
View Full Code Here

     *             connection.
     */
    private SMPPPacket readNextPacketInternal()
            throws java.io.IOException, SMPPProtocolException {
        try {
            SMPPPacket pak = null;
            int id = -1;

            this.buf = link.read(this.buf);
            id = SMPPIO.bytesToInt(this.buf, 4, 4);
            pak = PacketFactory.newInstance(id);

            if (pak != null) {
                pak.readFrom(this.buf, 0);
                if (LOGGER.isDebugEnabled()) {
                    StringBuffer b = new StringBuffer("Packet Received: ");
                    int l = pak.getLength();
                    int s = pak.getCommandStatus();
                    int n = pak.getSequenceNum();
                    b.append("id:").append(Integer.toHexString(id))
                    .append(" len:").append(Integer.toString(l))
                    .append(" st:").append(Integer.toString(s))
                    .append(" sq:").append(Integer.toString(n));
                    LOGGER.debug(b.toString());
View Full Code Here

    /**
     * Listener thread method for asynchronous communication.
     */
    public void run() {
        SMPPPacket pak = null;
        int smppEx = 0;
        SMPPEvent exitEvent = null;
        int tooManyIOEx = 5;

        LOGGER.info("Receiver thread started");
View Full Code Here

        if (!this.interfaceVersion.isSupported(commandId)) {
            throw new VersionException(
                    "Command is not supported in this SMPP version");
        }

        SMPPPacket response = PacketFactory.newInstance(commandId);
        response.setVersion(this.interfaceVersion);
        if (this.seqNumScheme != null) {
            response.setSequenceNum(this.seqNumScheme.nextNumber());
        }

        if (defaultAlphabet != null) {
            response.setAlphabet(defaultAlphabet, 0);
        }

        return response;
    }
View Full Code Here

     */
    protected SMPPResponse waitForResponsePacket(SMPPPacket req)
            throws java.net.SocketTimeoutException, java.io.IOException,
            SMPPProtocolException {
        try {
            SMPPPacket resp = null;

            int expectedSeq = req.getSequenceNum();
            while (true) {
                resp = readNextPacketInternal();
                if (!resp.isRequest()
                        && resp.getSequenceNum() == expectedSeq) {
                    break;
                } else {
                    LOGGER.info("Queuing unexpected sequence numbered packet.");
                    if (LOGGER.isDebugEnabled()) {
                        StringBuffer err = new StringBuffer("Expected:")
                        .append(expectedSeq).append(" but got ")
                        .append(resp.getSequenceNum()).append(" type: ")
                        .append(resp.getCommandId());
                        LOGGER.debug(err.toString());
                    }
                    packetQueue.add(resp);
                }
            }
View Full Code Here

     *             connection.
     */
    private SMPPPacket readNextPacketInternal()
            throws java.io.IOException, SMPPProtocolException {
        try {
            SMPPPacket pak = null;
            int id = -1;

            this.buf = link.read(this.buf);
            id = SMPPIO.bytesToInt(this.buf, 4, 4);
            pak = PacketFactory.newInstance(id);

            if (pak != null) {
                pak.readFrom(this.buf, 0);
                if (LOGGER.isDebugEnabled()) {
                    StringBuffer b = new StringBuffer("Packet Received: ");
                    int l = pak.getLength();
                    int s = pak.getCommandStatus();
                    int n = pak.getSequenceNum();
                    b.append("id:").append(Integer.toHexString(id))
                    .append(" len:").append(Integer.toString(l))
                    .append(" st:").append(Integer.toString(s))
                    .append(" sq:").append(Integer.toString(n));
                    LOGGER.debug(b.toString());
View Full Code Here

    /**
     * Listener thread method for asynchronous communication.
     */
    public void run() {
        SMPPPacket pak = null;
        int smppEx = 0;
        SMPPEvent exitEvent = null;
        int tooManyIOEx = 5;

        LOGGER.info("Receiver thread started");
View Full Code Here

        if (!this.interfaceVersion.isSupported(commandId)) {
            throw new VersionException(
                    "Command is not supported in this SMPP version");
        }

        SMPPPacket response = PacketFactory.newInstance(commandId);
        response.setVersion(this.interfaceVersion);
        if (this.seqNumScheme != null) {
            response.setSequenceNum(this.seqNumScheme.nextNumber());
        }

        if (defaultAlphabet != null) {
            response.setAlphabet(defaultAlphabet, 0);
        }

        return response;
    }
View Full Code Here

TOP

Related Classes of ie.omk.smpp.message.SMPPPacket

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.