public void setConfiguration() { this.configuration = new SmppServerConfiguration(); configuration.setPort(PORT); configuration.setMaxConnectionSize(10); configuration.setNonBlockingSocketsEnabled(true); configuration.setDefaultRequestExpiryTimeout(30000); configuration.setDefaultWindowMonitorInterval(15000); configuration.setDefaultWindowSize(5); configuration.setDefaultWindowWaitTimeout(configuration.getDefaultRequestExpiryTimeout()); configuration.setDefaultSessionCountersEnabled(true); configuration.setJmxEnabled(true); configuration.setReuseAddress(true); }
public MockSmppServer() throws SmppChannelException { ThreadPoolExecutor executor = (ThreadPoolExecutor) Executors.newCachedThreadPool(); ScheduledThreadPoolExecutor monitorExecutor = (ScheduledThreadPoolExecutor) Executors.newScheduledThreadPool( 1, new ThreadFactory() { private AtomicInteger sequence = new AtomicInteger(0); @Override public Thread newThread(Runnable r) { Thread t = new Thread(r); t.setName("SmppServerSessionWindowMonitorPool-" + sequence.getAndIncrement()); return t; } }); // create a server configuration SmppServerConfiguration configuration = new SmppServerConfiguration(); configuration.setHost("127.0.0.1"); configuration.setPort(2776); configuration.setMaxConnectionSize(10); configuration.setNonBlockingSocketsEnabled(true); configuration.setDefaultRequestExpiryTimeout(30000); configuration.setDefaultWindowMonitorInterval(15000); configuration.setDefaultWindowSize(5); configuration.setDefaultWindowWaitTimeout(configuration.getDefaultRequestExpiryTimeout()); configuration.setDefaultSessionCountersEnabled(true); configuration.setJmxEnabled(true); // create a server, start it up smppServer = new DefaultSmppServer( configuration, new DefaultSmppServerHandler(), executor, monitorExecutor); smppServer.start(); logger.info("SMPP server started! Server counters: {} " + smppServer.getCounters()); }