コード例 #1
0
 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();
   }
 }
コード例 #2
0
 @Test
 public void port() {
   assertThat(simplePushServerConfig.port(), is(9999));
   assertThat(simplePushServerConfig.password(), is(notNullValue()));
 }