Examples of PduResponse


Examples of com.cloudhopper.smpp.pdu.PduResponse

            // send the response back -- this should be routed as n ExpectedPduResponse....
            simulator0.sendPdu(el0Resp);

            // we should have received a PDU response
            PduAsyncResponse asyncpdu0 = sessionHandler.getReceivedExpectedPduResponses().poll(1000, TimeUnit.MILLISECONDS);
            PduResponse pdu0 = asyncpdu0.getResponse();
            Assert.assertNotNull("Unable to receive expected PDU response -- perhaps it was routed incorrectly?", pdu0);
            Assert.assertEquals(SmppConstants.CMD_ID_ENQUIRE_LINK_RESP, pdu0.getCommandId());
            Assert.assertEquals(0, pdu0.getCommandStatus());
            Assert.assertEquals(16, pdu0.getCommandLength());
            Assert.assertEquals(0x1000, pdu0.getSequenceNumber());   
        } finally {
            SmppSessionUtil.close(session);
        }
    }
View Full Code Here

Examples of com.cloudhopper.smpp.pdu.PduResponse

            // schedule this response on the simulator
            simulator0.addPduToWriteOnNextPduReceived(ubResp);

            // send asynchronously (no response will be received yet)
            PduResponse pdu0 = session.sendRequestAndGetResponse(el0, 2000);
            logger.debug("{}", pdu0);

            // NOTE: this internal method is OK to return an unexpected response
            Assert.assertEquals(16, pdu0.getCommandLength());
            Assert.assertEquals(SmppConstants.CMD_ID_UNBIND_RESP, pdu0.getCommandId());
            Assert.assertEquals(0, pdu0.getCommandStatus());
            Assert.assertEquals(0x1000, pdu0.getSequenceNumber());
            Assert.assertEquals(true, pdu0.isResponse());
        } finally {
            SmppSessionUtil.close(session);
        }
    }
View Full Code Here

Examples of com.cloudhopper.smpp.pdu.PduResponse

            ubResp.setSequenceNumber(el0.getSequenceNumber());

            // schedule this response on the simulator
            simulator0.addPduToWriteOnNextPduReceived(ubResp);

            PduResponse pdu0 = null;
            try {
                EnquireLinkResp el0Resp = session.enquireLink(el0, 200);
                Assert.fail();
            } catch (UnexpectedPduResponseException e) {
                // correct behavior
                pdu0 = e.getResponsePdu();
            }

            logger.debug("unexpected pdu: {}", pdu0);

            Assert.assertEquals(16, pdu0.getCommandLength());
            Assert.assertEquals(SmppConstants.CMD_ID_UNBIND_RESP, pdu0.getCommandId());
            Assert.assertEquals(0, pdu0.getCommandStatus());
            Assert.assertEquals(0x1000, pdu0.getSequenceNumber());
            Assert.assertEquals(true, pdu0.isResponse());
        } finally {
            SmppSessionUtil.close(session);
        }
    }
View Full Code Here

Examples of com.cloudhopper.smpp.pdu.PduResponse

            // wait for an expected pdu response
            PduAsyncResponse asyncpdu0 = sessionHandler.getReceivedExpectedPduResponses().poll(1000, TimeUnit.MILLISECONDS);
            logger.debug("{}", asyncpdu0);

            PduResponse pdu0 = asyncpdu0.getResponse();


            /**
            PduResponse pdu0 = null;
            try {
View Full Code Here

Examples of com.cloudhopper.smpp.pdu.PduResponse

            simulator0.sendPdu(el0Resp);

            // we should have received an unexpected PDU response
            Assert.assertEquals(0, sessionHandler.getReceivedPduRequests().size());
            Assert.assertEquals(0, sessionHandler.getReceivedExpectedPduResponses().size());
            PduResponse pdu0 = sessionHandler.getReceivedUnexpectedPduResponses().poll(1000, TimeUnit.MILLISECONDS);
            Assert.assertNotNull("Unable to receive unexpected PDU response -- perhaps it was routed incorrectly?", pdu0);
            Assert.assertEquals(SmppConstants.CMD_ID_ENQUIRE_LINK_RESP, pdu0.getCommandId());
            Assert.assertEquals(0, pdu0.getCommandStatus());
            Assert.assertEquals(16, pdu0.getCommandLength());
            Assert.assertEquals(0x1001, pdu0.getSequenceNumber());

            Assert.assertEquals(0, sessionHandler.getReceivedUnexpectedPduResponses().size());
        } finally {
            SmppSessionUtil.close(session);
        }
View Full Code Here

Examples of com.cloudhopper.smpp.pdu.PduResponse

            // send a response to a request that was NEVER sent
            simulator0.sendPdu(el0Resp);

            // we should have received a PDU response
            PduResponse pdu0 = sessionHandler.getReceivedUnexpectedPduResponses().poll(1000, TimeUnit.MILLISECONDS);
            Assert.assertNotNull("Unable to receive unexpected PDU response -- perhaps it was routed incorrectly?", pdu0);
            Assert.assertEquals(SmppConstants.CMD_ID_ENQUIRE_LINK_RESP, pdu0.getCommandId());
            Assert.assertEquals(0, pdu0.getCommandStatus());
            Assert.assertEquals(16, pdu0.getCommandLength());
            Assert.assertEquals(0x1000, pdu0.getSequenceNumber());

            Assert.assertEquals(0, sessionHandler.getReceivedPduRequests().size());
            Assert.assertEquals(0, sessionHandler.getReceivedExpectedPduResponses().size());
            Assert.assertEquals(0, sessionHandler.getReceivedUnexpectedPduResponses().size());
        } finally {
View Full Code Here

Examples of com.cloudhopper.smpp.pdu.PduResponse

        assertValidRequest(request);
        boolean bound = false;
        try {
            this.state.set(STATE_BINDING);

            PduResponse response = sendRequestAndGetResponse(request, timeoutInMillis);
            SmppSessionUtil.assertExpectedResponse(request, response);
            BaseBindResp bindResponse = (BaseBindResp)response;

            // check if the bind succeeded
            if (bindResponse == null || bindResponse.getCommandStatus() != SmppConstants.STATUS_OK) {
View Full Code Here

Examples of com.cloudhopper.smpp.pdu.PduResponse

    }

    @Override
    public EnquireLinkResp enquireLink(EnquireLink request, long timeoutInMillis) throws RecoverablePduException, UnrecoverablePduException, SmppTimeoutException, SmppChannelException, InterruptedException {
        assertValidRequest(request);
        PduResponse response = sendRequestAndGetResponse(request, timeoutInMillis);
        SmppSessionUtil.assertExpectedResponse(request, response);
        return (EnquireLinkResp)response;
    }
View Full Code Here

Examples of com.cloudhopper.smpp.pdu.PduResponse

            logger.warn("PDU request expired: {}", pduRequest);
        }

        @Override
        public PduResponse firePduRequestReceived(PduRequest pduRequest) {
            PduResponse response = pduRequest.createResponse();

            // do any logic here
           
            return response;
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.