public void run() throws Exception { final DataStore datastore = new InMemoryDataStore(); final EventLoopGroup bossGroup = new NioEventLoopGroup(); final EventLoopGroup workerGroup = new NioEventLoopGroup(); final DefaultEventExecutorGroup reaperExcutorGroup = new DefaultEventExecutorGroup(1); try { final ServerBootstrap sb = new ServerBootstrap(); sb.group(bossGroup, workerGroup) .channel(NioServerSocketChannel.class) .childHandler( new SockJSChannelInitializer( simplePushConfig, datastore, sockJSConfig, reaperExcutorGroup)); final Channel ch = sb.bind(simplePushConfig.host(), simplePushConfig.port()).sync().channel(); System.out.println("SockJS server with options " + options); ch.closeFuture().sync(); } finally { bossGroup.shutdownGracefully(); workerGroup.shutdownGracefully(); } }
@Test public void notifierMaxThreads() { assertThat(simplePushServerConfig.notifierMaxThreads(), is(2)); }
@Test public void acknowledgementInterval() { assertThat(simplePushServerConfig.acknowledmentInterval(), is(80000L)); }
@Test public void endpointTls() { assertThat(simplePushServerConfig.useEndpointTls(), is(true)); }
@Test public void endpointPrefix() { assertThat(simplePushServerConfig.endpointPrefix(), equalTo("/endpoint")); }
@Test public void endpointPort() { assertThat(simplePushServerConfig.endpointPort(), is(8889)); }
@Test public void endpointHost() { assertThat(simplePushServerConfig.endpointHost(), equalTo("external")); }
@Test public void useragentReaperTimeout() { assertThat(simplePushServerConfig.userAgentReaperTimeout(), is(16000L)); }
@Test public void tokenKey() { assertThat(simplePushServerConfig.password(), is(notNullValue())); }
@Test public void port() { assertThat(simplePushServerConfig.port(), is(9999)); assertThat(simplePushServerConfig.password(), is(notNullValue())); }
@Test public void host() { assertThat(simplePushServerConfig.host(), equalTo("localhost")); }