Search in sources :

Example 1 with SmppServer

use of com.cloudhopper.smpp.SmppServer in project smscgateway by RestComm.

the class SlowServer method test.

private void test(String[] args) throws Exception {
    this.port = Integer.parseInt(args[0]);
    this.maxConnectionSize = Integer.parseInt(args[1]);
    this.nonBlockingSocketsEnabled = Boolean.parseBoolean(args[2]);
    this.defaultRequestExpiryTimeout = Integer.parseInt(args[3]);
    this.defaultWindowMonitorInterval = Integer.parseInt(args[4]);
    this.defaultWindowSize = Integer.parseInt(args[5]);
    this.defaultWindowWaitTimeout = Long.parseLong(args[6]);
    this.defaultSessionCountersEnabled = Boolean.parseBoolean(args[7]);
    this.jmxEnabled = Boolean.parseBoolean(args[8]);
    if (port < 1) {
        throw new Exception("port cannot be less than 1");
    }
    if (maxConnectionSize < 1) {
        throw new Exception("maxConnectionSize cannot be less than 1");
    }
    if (defaultRequestExpiryTimeout < 1) {
        throw new Exception("defaultRequestExpiryTimeout to send cannot be less than 1");
    }
    if (defaultWindowMonitorInterval < 1) {
        throw new Exception("defaultWindowMonitorInterval cannot be less than 1");
    }
    if (defaultWindowSize < 1) {
        throw new Exception("defaultWindowSize cannot be less than 1");
    }
    logger.info("port=" + port);
    logger.info("maxConnectionSize=" + maxConnectionSize);
    logger.info("nonBlockingSocketsEnabled=" + nonBlockingSocketsEnabled);
    logger.info("defaultRequestExpiryTimeout=" + defaultRequestExpiryTimeout);
    logger.info("defaultWindowMonitorInterval=" + defaultWindowMonitorInterval);
    logger.info("defaultWindowSize=" + defaultWindowSize);
    logger.info("defaultWindowWaitTimeout=" + defaultWindowWaitTimeout);
    logger.info("defaultSessionCountersEnabled=" + defaultSessionCountersEnabled);
    logger.info("jmxEnabled=" + jmxEnabled);
    SmppServerConfiguration configuration = new SmppServerConfiguration();
    configuration.setPort(port);
    configuration.setMaxConnectionSize(maxConnectionSize);
    configuration.setNonBlockingSocketsEnabled(nonBlockingSocketsEnabled);
    configuration.setDefaultRequestExpiryTimeout(defaultRequestExpiryTimeout);
    configuration.setDefaultWindowMonitorInterval(defaultWindowMonitorInterval);
    configuration.setDefaultWindowSize(defaultWindowSize);
    configuration.setDefaultWindowWaitTimeout(defaultWindowWaitTimeout);
    configuration.setDefaultSessionCountersEnabled(defaultSessionCountersEnabled);
    configuration.setJmxEnabled(jmxEnabled);
    SmppServer smppServer = new DefaultSmppServer(configuration, new DefaultSmppServerHandler());
    logger.info("About to start SMPP slow server");
    smppServer.start();
    logger.info("SMPP slow server started");
    System.out.println("Press any key to stop server");
    System.in.read();
    logger.info("SMPP server stopping");
    smppServer.stop();
    logger.info("SMPP server stopped");
}
Also used : DefaultSmppServer(com.cloudhopper.smpp.impl.DefaultSmppServer) DefaultSmppServer(com.cloudhopper.smpp.impl.DefaultSmppServer) SmppServer(com.cloudhopper.smpp.SmppServer) SmppServerConfiguration(com.cloudhopper.smpp.SmppServerConfiguration) SmppProcessingException(com.cloudhopper.smpp.type.SmppProcessingException)

Aggregations

SmppServer (com.cloudhopper.smpp.SmppServer)1 SmppServerConfiguration (com.cloudhopper.smpp.SmppServerConfiguration)1 DefaultSmppServer (com.cloudhopper.smpp.impl.DefaultSmppServer)1 SmppProcessingException (com.cloudhopper.smpp.type.SmppProcessingException)1