Package com.cloudhopper.smpp

Examples of com.cloudhopper.smpp.SmppSessionConfiguration


        // delegate any bind request to the server handler
        // variables we track for a successful bind request
        BaseBind bindRequest = (BaseBind)pdu;

        // create a default session configuration based on this bind request
        SmppSessionConfiguration sessionConfiguration = createSessionConfiguration(bindRequest);

        // assign a new identifier for this session
        Long sessionId = server.nextSessionId();

        try {
View Full Code Here


        logger.info("Connection closed with [{}]", channelName);
        closeChannelAndCancelTimer();
    }

    protected SmppSessionConfiguration createSessionConfiguration(BaseBind bindRequest) {
        SmppSessionConfiguration sessionConfiguration = new SmppSessionConfiguration();
        sessionConfiguration.setName("SmppServerSession." + bindRequest.getSystemId() + "." + bindRequest.getSystemType());
        sessionConfiguration.setSystemId(bindRequest.getSystemId());
        sessionConfiguration.setPassword(bindRequest.getPassword());
        sessionConfiguration.setSystemType(bindRequest.getSystemType());
        sessionConfiguration.setBindTimeout(server.getConfiguration().getBindTimeout());
        sessionConfiguration.setAddressRange(bindRequest.getAddressRange());
        sessionConfiguration.setHost(ChannelUtil.getChannelRemoteHost(channel));
        sessionConfiguration.setPort(ChannelUtil.getChannelRemotePort(channel));
        sessionConfiguration.setInterfaceVersion(bindRequest.getInterfaceVersion());

        LoggingOptions loggingOptions = new LoggingOptions();
        loggingOptions.setLogPdu(true);
        sessionConfiguration.setLoggingOptions(loggingOptions);

        // handle all 3 types...
        if (bindRequest instanceof BindTransceiver) {
            sessionConfiguration.setType(SmppBindType.TRANSCEIVER);
        } else if (bindRequest instanceof BindReceiver) {
            sessionConfiguration.setType(SmppBindType.RECEIVER);
        } else if (bindRequest instanceof BindTransmitter) {
            sessionConfiguration.setType(SmppBindType.TRANSMITTER);
        }
       
        // new default options set from server config
        sessionConfiguration.setWindowSize(server.getConfiguration().getDefaultWindowSize());
        sessionConfiguration.setWindowWaitTimeout(server.getConfiguration().getDefaultWindowWaitTimeout());
        sessionConfiguration.setWindowMonitorInterval(server.getConfiguration().getDefaultWindowMonitorInterval());
        sessionConfiguration.setRequestExpiryTimeout(server.getConfiguration().getDefaultRequestExpiryTimeout());
        sessionConfiguration.setCountersEnabled(server.getConfiguration().isDefaultSessionCountersEnabled());

        return sessionConfiguration;
    }
View Full Code Here

        DefaultSmppServer smppServer = new DefaultSmppServer(configuration, serverHandler);
        return smppServer;
    }

    private SmppSessionConfiguration createClientConfigurationNoSSL() {
        SmppSessionConfiguration configuration = new SmppSessionConfiguration();
        configuration.setWindowSize(1);
        configuration.setName("Tester.Session.0");
        configuration.setType(SmppBindType.TRANSCEIVER);
        configuration.setHost("localhost");
        configuration.setPort(PORT);
        configuration.setConnectTimeout(200);
        configuration.setBindTimeout(200);
        configuration.setSystemId(SYSTEMID);
        configuration.setPassword(PASSWORD);
        configuration.getLoggingOptions().setLogBytes(true);
        return configuration;
    }
View Full Code Here

        configuration.getLoggingOptions().setLogBytes(true);
        return configuration;
    }

    private SmppSessionConfiguration createClientConfigurationWeakSSL() {
        SmppSessionConfiguration configuration = createClientConfigurationNoSSL();
  SslConfiguration sslConfig = new SslConfiguration();
  configuration.setUseSsl(true);
  configuration.setSslConfiguration(sslConfig);
        return configuration;
    }
View Full Code Here

  configuration.setSslConfiguration(sslConfig);
        return configuration;
    }

    private SmppSessionConfiguration createClientConfigurationStrongSSL() {
        SmppSessionConfiguration configuration = createClientConfigurationNoSSL();
  SslConfiguration sslConfig = new SslConfiguration();
  configuration.setUseSsl(true);
  configuration.setSslConfiguration(sslConfig);
        return configuration;
    }
View Full Code Here

        // server is SSL, client is not!
        DefaultSmppServer server0 = createSmppServer(createServerConfigurationWeakSSL());
        server0.start();

        DefaultSmppClient client0 = new DefaultSmppClient();
        SmppSessionConfiguration sessionConfig0 = createClientConfigurationNoSSL();
        // verify that the bad connection is detected earlier than the 30 second timeouts
        sessionConfig0.setConnectTimeout(30000);
        sessionConfig0.setBindTimeout(30000);

        long start = System.currentTimeMillis();
        try {
            // this should fail
            SmppSession session0 = client0.bind(sessionConfig0);
View Full Code Here

        // server is not SSL, client is SSL
        DefaultSmppServer server0 = createSmppServer(createServerConfigurationNoSSL());
        server0.start();

        DefaultSmppClient client0 = new DefaultSmppClient();
        SmppSessionConfiguration sessionConfig0 = createClientConfigurationWeakSSL();
        // the server immediately closed the connection and there is a workaround
        // enabled to detect this closure much faster than a 30 second connect timeout
        // we set these to be longer than normal to verify the bind fails in less
        // time than these settings are set for
        sessionConfig0.setConnectTimeout(30000);
        sessionConfig0.setBindTimeout(30000);
        long start = System.currentTimeMillis();
        try {
            // this should fail
            SmppSession session0 = client0.bind(sessionConfig0);
            Assert.fail();
View Full Code Here

        // both server and client are SSL
        DefaultSmppServer server0 = createSmppServer(createServerConfigurationWeakSSL());
        server0.start();

        DefaultSmppClient client0 = new DefaultSmppClient();
        SmppSessionConfiguration sessionConfig0 = createClientConfigurationWeakSSL();

        try {
            // this should actually work
            SmppSession session0 = client0.bind(sessionConfig0);
            Thread.sleep(200);
View Full Code Here

        // both server and client are SSL
        DefaultSmppServer server0 = createSmppServer(createServerConfigurationWeakSSL());
        server0.start();

        DefaultSmppClient client0 = new DefaultSmppClient();
        SmppSessionConfiguration sessionConfig0 = createClientConfigurationWeakSSL();

        try {
            SmppSession session0 = client0.bind(sessionConfig0);
            Thread.sleep(100);
View Full Code Here

        // both server and client are SSL with compatible certificate.
        DefaultSmppServer server0 = createSmppServer(createServerConfigurationStrongSSL());
        server0.start();

        DefaultSmppClient client0 = new DefaultSmppClient();
        SmppSessionConfiguration sessionConfig0 = createClientConfigurationStrongSSL();

        try {
            // this should work
            SmppSession session0 = client0.bind(sessionConfig0);
            Assert.assertNotNull(session0);
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.