Package com.cloudhopper.smpp

Examples of com.cloudhopper.smpp.SmppSessionConfiguration


        server0.getConfiguration().setBindTimeout(50);
        server0.start();

        try {
            DefaultSmppClient client0 = new DefaultSmppClient();
            SmppSessionConfiguration sessionConfig0 = createDefaultConfiguration();

            // we will not use the proper method of binding since we need to
            DefaultSmppSession session0 = client0.doOpen(sessionConfig0, new DefaultSmppSessionHandler());

            // there is a bind timeout of 50 ms and we'll wait 100 ms
View Full Code Here


            // initiate bind requests on all sessions we care about -- this should
            // technicaly "starve" the server of worker threads since they'll all
            // be blocked in a Thread.sleep
            for (int i = 0; i < workersToStarveWith; i++) {
                DefaultSmppClient client0 = new DefaultSmppClient();
                SmppSessionConfiguration sessionConfig0 = createDefaultConfiguration();
                sessionConfig0.setName("WorkerTest.Session." + i);
                // don't use default method of binding, connect the socket first
                DefaultSmppSession session0 = client0.doOpen(sessionConfig0, new DefaultSmppSessionHandler());
                // try to bind and execute a bind request and wait for a bind response
                BaseBind bindRequest = client0.createBindRequest(sessionConfig0);
                try {
                    // just send the request without caring if it succeeds
                    session0.sendRequestPdu(bindRequest, 2000, false);
                } catch (SmppChannelException e) {
                    // correct behavior
                }
            }
           
            // now try to bind normally -- since all previous workers are "starved"
            // this should fail to bind and the socket closed by the "BindTimer"
            DefaultSmppClient client0 = new DefaultSmppClient();
            SmppSessionConfiguration sessionConfig0 = createDefaultConfiguration();
            sessionConfig0.setName("WorkerTestChannelClosed.Session");
            sessionConfig0.setBindTimeout(750);
           
            try {
                client0.bind(sessionConfig0);
                Assert.fail();
            } catch (SmppChannelException e) {
View Full Code Here

        // THIS VERSION DOESN'T - WILL HANG JVM UNTIL CLOSED
        final DefaultSmppClient bootstrap = new DefaultSmppClient(Executors.newCachedThreadPool());

        final DefaultSmppSessionHandler sessionHandler = new ClientSmppSessionHandler();

        final SmppSessionConfiguration config0 = new SmppSessionConfiguration();
        config0.setWindowSize(1);
        config0.setName("Tester.Session.0");
        config0.setType(SmppBindType.TRANSCEIVER);
        config0.setHost("localhost");
        config0.setPort(2776);
        config0.setConnectTimeout(10000);
        config0.setSystemId("smppclient1");
        config0.setPassword("password");

        Runnable bindRunnable = new Runnable() {

            public void run() {
                SmppSession session0 = null;
View Full Code Here

        //
        // setup configuration for a client session
        //
        DefaultSmppSessionHandler sessionHandler = new ClientSmppSessionHandler();

        SmppSessionConfiguration config0 = new SmppSessionConfiguration();
        config0.setWindowSize(1);
        config0.setName("Tester.Session.0");
        config0.setType(SmppBindType.TRANSCEIVER);
        config0.setHost("127.0.0.1");
        config0.setPort(2776);
        config0.setConnectTimeout(10000);
        config0.setSystemId("1234567890");
        config0.setPassword("password");
        config0.getLoggingOptions().setLogBytes(true);
        // to enable monitoring (request expiration)
        config0.setRequestExpiryTimeout(30000);
        config0.setWindowMonitorInterval(15000);
        config0.setCountersEnabled(true);

        //
        // create session, enquire link, submit an sms, close session
        //
        SmppSession session0 = null;
View Full Code Here

TOP

Related Classes of com.cloudhopper.smpp.SmppSessionConfiguration

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.