Package com.cloudhopper.smpp.pdu

Examples of com.cloudhopper.smpp.pdu.BaseBindResp


            // create a bind request based on this config
            BaseBind bindRequest = client0.createBindRequest(sessionConfig0);

            // execute a bind request and wait for a bind response
            BaseBindResp bindResponse = session0.bind(bindRequest, 200);

            Thread.sleep(100);

            SmppServerSession serverSession0 = serverHandler.sessions.iterator().next();
            Assert.assertEquals(1, serverHandler.sessions.size());
            Assert.assertEquals(1, server0.getChannels().size());
            Assert.assertEquals(true, serverSession0.isBound());
            Assert.assertEquals(SmppBindType.TRANSCEIVER, serverSession0.getBindType());
            Assert.assertEquals(SmppSession.Type.SERVER, serverSession0.getLocalType());
            Assert.assertEquals(SmppSession.Type.CLIENT, serverSession0.getRemoteType());

            // verify "requested" version is 3.4
            Assert.assertEquals((byte)0x34, serverSession0.getConfiguration().getInterfaceVersion());
            // verify the session interface version is normalized to 3.4
            Assert.assertEquals(SmppConstants.VERSION_3_4, serverSession0.getInterfaceVersion());
            Assert.assertEquals(true, serverSession0.areOptionalParametersSupported());

            // verify client session version settings are correct
            Assert.assertEquals((byte)0x34, session0.getConfiguration().getInterfaceVersion());
            Assert.assertEquals((byte)0x34, session0.getInterfaceVersion());
            Assert.assertEquals(true, session0.areOptionalParametersSupported());

            // verify 1 optional parameter was included in bind response
            Assert.assertEquals(1, bindResponse.getOptionalParameterCount());
            Assert.assertEquals("cloudhopper", bindResponse.getSystemId());

            Tlv scInterfaceVersion = bindResponse.getOptionalParameter(SmppConstants.TAG_SC_INTERFACE_VERSION);
            Assert.assertNotNull(scInterfaceVersion);
            Assert.assertEquals(SmppConstants.VERSION_3_4, scInterfaceVersion.getValueAsByte());

            serverSession0.close();
            Thread.sleep(200);
View Full Code Here


            // create a bind request based on this config
            BaseBind bindRequest = client0.createBindRequest(sessionConfig0);

            // execute a bind request and wait for a bind response
            BaseBindResp bindResponse = session0.bind(bindRequest, 200);

            Thread.sleep(100);

            SmppServerSession serverSession0 = serverHandler.sessions.iterator().next();
            Assert.assertEquals(1, serverHandler.sessions.size());
            Assert.assertEquals(1, server0.getChannels().size());
            Assert.assertEquals(true, serverSession0.isBound());
            Assert.assertEquals(SmppBindType.TRANSCEIVER, serverSession0.getBindType());
            Assert.assertEquals(SmppSession.Type.SERVER, serverSession0.getLocalType());
            Assert.assertEquals(SmppSession.Type.CLIENT, serverSession0.getRemoteType());

            // verify "requested" version is 3.5
            Assert.assertEquals((byte)0x35, serverSession0.getConfiguration().getInterfaceVersion());
            // verify the session interface version is normalized to 3.4
            Assert.assertEquals(SmppConstants.VERSION_3_4, serverSession0.getInterfaceVersion());
            Assert.assertEquals(true, serverSession0.areOptionalParametersSupported());

            // verify client session version settings are correct
            Assert.assertEquals((byte)0x35, session0.getConfiguration().getInterfaceVersion());
            Assert.assertEquals((byte)0x34, session0.getInterfaceVersion());
            Assert.assertEquals(true, session0.areOptionalParametersSupported());

            // verify 1 optional parameter was included in bind response
            Assert.assertEquals(1, bindResponse.getOptionalParameterCount());
            Assert.assertEquals("cloudhopper", bindResponse.getSystemId());

            Tlv scInterfaceVersion = bindResponse.getOptionalParameter(SmppConstants.TAG_SC_INTERFACE_VERSION);
            Assert.assertNotNull(scInterfaceVersion);
            Assert.assertEquals(SmppConstants.VERSION_3_4, scInterfaceVersion.getValueAsByte());

            serverSession0.close();
            Thread.sleep(200);
View Full Code Here

            // try to bind and execute a bind request and wait for a bind response
            BaseBind bindRequest = client0.createBindRequest(sessionConfig0);

            try {
                BaseBindResp bindResponse = session0.bind(bindRequest, 200);
                Assert.fail();
            } catch (SmppChannelException e) {
                // correct behavior
            }
View Full Code Here

        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) {
                // bind failed for a specific reason
                throw new SmppBindException(bindResponse);
            }

            // if we make it all the way here, we're good and bound
            bound = true;

            //
            // negotiate version in use based on response back from server
            //
            Tlv scInterfaceVersion = bindResponse.getOptionalParameter(SmppConstants.TAG_SC_INTERFACE_VERSION);

            if (scInterfaceVersion == null) {
                // this means version 3.3 is in use
                this.interfaceVersion = SmppConstants.VERSION_3_3;
            } else {
View Full Code Here

            // create a bind request based on this config
            BaseBind bindRequest = client0.createBindRequest(sessionConfig0);

            // execute a bind request and wait for a bind response
            BaseBindResp bindResponse = session0.bind(bindRequest, 200);

            Thread.sleep(100);

            SmppServerSession serverSession0 = serverHandler.sessions.iterator().next();
            Assert.assertEquals(1, serverHandler.sessions.size());
            Assert.assertEquals(1, server0.getChannels().size());
            Assert.assertEquals(true, serverSession0.isBound());
            Assert.assertEquals(SmppBindType.TRANSCEIVER, serverSession0.getBindType());
            Assert.assertEquals(SmppSession.Type.SERVER, serverSession0.getLocalType());
            Assert.assertEquals(SmppSession.Type.CLIENT, serverSession0.getRemoteType());

            // verify "requested" version is still 3.3
            Assert.assertEquals(SmppConstants.VERSION_3_3, serverSession0.getConfiguration().getInterfaceVersion());
            // verify the session interface version is normalized to 3.3
            Assert.assertEquals(SmppConstants.VERSION_3_3, serverSession0.getInterfaceVersion());
            Assert.assertEquals(false, serverSession0.areOptionalParametersSupported());

            // verify client session version settings are correct
            Assert.assertEquals((byte)0x33, session0.getConfiguration().getInterfaceVersion());
            Assert.assertEquals((byte)0x33, session0.getInterfaceVersion());
            Assert.assertEquals(false, session0.areOptionalParametersSupported());

            // verify NO optional parameters were included in bind response
            Assert.assertEquals(0, bindResponse.getOptionalParameterCount());
            Assert.assertEquals("cloudhopper", bindResponse.getSystemId());

            serverSession0.close();
            Thread.sleep(200);
            Assert.assertEquals(0, serverHandler.sessions.size());
            Assert.assertEquals(0, server0.getChannels().size());
View Full Code Here

            // create a bind request based on this config
            BaseBind bindRequest = client0.createBindRequest(sessionConfig0);

            // execute a bind request and wait for a bind response
            BaseBindResp bindResponse = session0.bind(bindRequest, 200);

            Thread.sleep(100);

            SmppServerSession serverSession0 = serverHandler.sessions.iterator().next();
            Assert.assertEquals(1, serverHandler.sessions.size());
            Assert.assertEquals(1, server0.getChannels().size());
            Assert.assertEquals(true, serverSession0.isBound());
            Assert.assertEquals(SmppBindType.TRANSCEIVER, serverSession0.getBindType());
            Assert.assertEquals(SmppSession.Type.SERVER, serverSession0.getLocalType());
            Assert.assertEquals(SmppSession.Type.CLIENT, serverSession0.getRemoteType());

            // verify "requested" version is 3.1
            Assert.assertEquals((byte)0x31, serverSession0.getConfiguration().getInterfaceVersion());
            // verify the session interface version is normalized to 3.3
            Assert.assertEquals(SmppConstants.VERSION_3_3, serverSession0.getInterfaceVersion());
            Assert.assertEquals(false, serverSession0.areOptionalParametersSupported());

            // verify client session version settings are correct
            Assert.assertEquals((byte)0x31, session0.getConfiguration().getInterfaceVersion());
            Assert.assertEquals((byte)0x33, session0.getInterfaceVersion());
            Assert.assertEquals(false, session0.areOptionalParametersSupported());

            // verify NO optional parameters were included in bind response
            Assert.assertEquals(0, bindResponse.getOptionalParameterCount());
            Assert.assertEquals("cloudhopper", bindResponse.getSystemId());

            serverSession0.close();
            Thread.sleep(200);
            Assert.assertEquals(0, serverHandler.sessions.size());
            Assert.assertEquals(0, server0.getChannels().size());
View Full Code Here

TOP

Related Classes of com.cloudhopper.smpp.pdu.BaseBindResp

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.