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 port() { assertThat(simplePushServerConfig.port(), is(9999)); assertThat(simplePushServerConfig.password(), is(notNullValue())); }