@Test void bind() throws Exception { final EventLoopGroup bossGroup = new NioEventLoopGroup(); final EventLoopGroup workerGroup = new NioEventLoopGroup(); final ServerBootstrap bootstrap = new ServerBootstrap(); bootstrap.group(bossGroup, workerGroup); final DssWebSocketChannelProperty property = DssWebSocketChannelProperty .builder() .host("127.0.0.1") .port(8181) .build(); final DssWebSocketChannelInitializer channelInitializer = new DssWebSocketChannelInitializer(); try { final DssWebSocketChannel dssWebSocketChannel = new DssWebSocketChannel(); final Channel channel = dssWebSocketChannel.bind(bootstrap, property, channelInitializer); final Socket socket = new Socket(); socket.connect(new InetSocketAddress("127.0.0.1", 8181)); assertTrue(socket.isConnected()); channel.close().sync(); } finally { assertNotNull(workerGroup); workerGroup.shutdownGracefully(); assertNotNull(bossGroup); bossGroup.shutdownGracefully(); } }
@Override public Channel bind(ServerBootstrap serverBootstrap, DssWebSocketChannelProperty dssWebsocketChannelProperty, DssWebSocketChannelInitializer dssWebsocketChannelInitializer) throws InterruptedException { Objects.requireNonNull(serverBootstrap); Objects.requireNonNull(dssWebsocketChannelProperty); Objects.requireNonNull(dssWebsocketChannelInitializer); return serverBootstrap .channel(NioServerSocketChannel.class) .handler(new LoggingHandler(dssWebsocketChannelProperty.getDssLogLevel().getNettyLogLevel())) .childHandler(dssWebsocketChannelInitializer) .bind(dssWebsocketChannelProperty.getHost(), dssWebsocketChannelProperty.getPort()) .sync() .channel(); }
DssWebSocketChannel implements DssChannel<DssWebSocketChannelProperty, DssWebSocketChannelInitializer> { @Override public Channel bind(ServerBootstrap serverBootstrap, DssWebSocketChannelProperty dssWebsocketChannelProperty, DssWebSocketChannelInitializer dssWebsocketChannelInitializer) throws InterruptedException { Objects.requireNonNull(serverBootstrap); Objects.requireNonNull(dssWebsocketChannelProperty); Objects.requireNonNull(dssWebsocketChannelInitializer); return serverBootstrap .channel(NioServerSocketChannel.class) .handler(new LoggingHandler(dssWebsocketChannelProperty.getDssLogLevel().getNettyLogLevel())) .childHandler(dssWebsocketChannelInitializer) .bind(dssWebsocketChannelProperty.getHost(), dssWebsocketChannelProperty.getPort()) .sync() .channel(); } }
DssWebSocketChannel implements DssChannel<DssWebSocketChannelProperty, DssWebSocketChannelInitializer> { @Override public Channel bind(ServerBootstrap serverBootstrap, DssWebSocketChannelProperty dssWebsocketChannelProperty, DssWebSocketChannelInitializer dssWebsocketChannelInitializer) throws InterruptedException { Objects.requireNonNull(serverBootstrap); Objects.requireNonNull(dssWebsocketChannelProperty); Objects.requireNonNull(dssWebsocketChannelInitializer); return serverBootstrap .channel(NioServerSocketChannel.class) .handler(new LoggingHandler(dssWebsocketChannelProperty.getDssLogLevel().getNettyLogLevel())) .childHandler(dssWebsocketChannelInitializer) .bind(dssWebsocketChannelProperty.getHost(), dssWebsocketChannelProperty.getPort()) .sync() .channel(); }  }
DssWebSocketChannel implements DssChannel<DssWebSocketChannelProperty, DssWebSocketChannelInitializer> { @Override public Channel bind(ServerBootstrap serverBootstrap, DssWebSocketChannelProperty dssWebsocketChannelProperty, DssWebSocketChannelInitializer dssWebsocketChannelInitializer) throws InterruptedException { Objects.requireNonNull(serverBootstrap); Objects.requireNonNull(dssWebsocketChannelProperty); Objects.requireNonNull(dssWebsocketChannelInitializer); return serverBootstrap .channel(NioServerSocketChannel.class) .handler(new LoggingHandler(dssWebsocketChannelProperty.getDssLogLevel().getNettyLogLevel())) .childHandler(dssWebsocketChannelInitializer) .bind(dssWebsocketChannelProperty.getHost(), dssWebsocketChannelProperty.getPort()) .sync() .channel(); }  @Override Channel bind(ServerBootstrap serverBootstrap, DssWebSocketChannelProperty dssWebsocketChannelProperty,
                        DssWebSocketChannelInitializer dssWebsocketChannelInitializer); }
DssWebSocketChannel implements DssChannel<DssWebSocketChannelProperty, DssWebSocketChannelInitializer> { @Override public Channel bind(ServerBootstrap serverBootstrap, DssWebSocketChannelProperty dssWebsocketChannelProperty, DssWebSocketChannelInitializer dssWebsocketChannelInitializer) throws InterruptedException { Objects.requireNonNull(serverBootstrap); Objects.requireNonNull(dssWebsocketChannelProperty); Objects.requireNonNull(dssWebsocketChannelInitializer); return serverBootstrap .channel(NioServerSocketChannel.class) .handler(new LoggingHandler(dssWebsocketChannelProperty.getDssLogLevel().getNettyLogLevel())) .childHandler(dssWebsocketChannelInitializer) .bind(dssWebsocketChannelProperty.getHost(), dssWebsocketChannelProperty.getPort()) .sync() .channel(); }  @Override Channel bind(ServerBootstrap serverBootstrap, DssWebSocketChannelProperty dssWebsocketChannelProperty,
                        DssWebSocketChannelInitializer dssWebsocketChannelInitializer);  }