@Test public void bind() throws Exception { final EventLoopGroup bossGroup = new NioEventLoopGroup(); final EventLoopGroup workerGroup = new NioEventLoopGroup(); final ServerBootstrap bootstrap = new ServerBootstrap(); bootstrap.group(bossGroup, workerGroup); final DssTcpChannelProperty property = DssTcpChannelProperty .builder() .host("127.0.0.1") .port(8181) .build(); final DssTcpChannelInitializer channelInitializer = new DssTcpChannelInitializer(); try { final DssTcpChannel dssTcpChannel = new DssTcpChannel(); final Channel channel = dssTcpChannel.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, DssTcpChannelProperty dssTcpChannelProperty, DssTcpChannelInitializer dssTcpChannelInitializer) throws InterruptedException { Objects.requireNonNull(serverBootstrap); Objects.requireNonNull(dssTcpChannelProperty); Objects.requireNonNull(dssTcpChannelInitializer); return serverBootstrap .channel(NioServerSocketChannel.class) .handler(new LoggingHandler(LogLevel.DEBUG)) .childHandler(dssTcpChannelInitializer) .bind(dssTcpChannelProperty.getHost(), dssTcpChannelProperty.getPort()) .sync() .channel(); }
DssTcpChannel implements DssChannel<DssTcpChannelProperty, DssTcpChannelInitializer> { @Override public Channel bind(ServerBootstrap serverBootstrap, DssTcpChannelProperty dssTcpChannelProperty, DssTcpChannelInitializer dssTcpChannelInitializer) throws InterruptedException { Objects.requireNonNull(serverBootstrap); Objects.requireNonNull(dssTcpChannelProperty); Objects.requireNonNull(dssTcpChannelInitializer); return serverBootstrap .channel(NioServerSocketChannel.class) .handler(new LoggingHandler(LogLevel.DEBUG)) .childHandler(dssTcpChannelInitializer) .bind(dssTcpChannelProperty.getHost(), dssTcpChannelProperty.getPort()) .sync() .channel(); } }
DssTcpChannel implements DssChannel<DssTcpChannelProperty, DssTcpChannelInitializer> { @Override public Channel bind(ServerBootstrap serverBootstrap, DssTcpChannelProperty dssTcpChannelProperty, DssTcpChannelInitializer dssTcpChannelInitializer) throws InterruptedException { Objects.requireNonNull(serverBootstrap); Objects.requireNonNull(dssTcpChannelProperty); Objects.requireNonNull(dssTcpChannelInitializer); return serverBootstrap .channel(NioServerSocketChannel.class) .handler(new LoggingHandler(LogLevel.DEBUG)) .childHandler(dssTcpChannelInitializer) .bind(dssTcpChannelProperty.getHost(), dssTcpChannelProperty.getPort()) .sync() .channel(); }  }
DssTcpChannel implements DssChannel<DssTcpChannelProperty, DssTcpChannelInitializer> { @Override public Channel bind(ServerBootstrap serverBootstrap, DssTcpChannelProperty dssTcpChannelProperty, DssTcpChannelInitializer dssTcpChannelInitializer) throws InterruptedException { Objects.requireNonNull(serverBootstrap); Objects.requireNonNull(dssTcpChannelProperty); Objects.requireNonNull(dssTcpChannelInitializer); return serverBootstrap .channel(NioServerSocketChannel.class) .handler(new LoggingHandler(LogLevel.DEBUG)) .childHandler(dssTcpChannelInitializer) .bind(dssTcpChannelProperty.getHost(), dssTcpChannelProperty.getPort()) .sync() .channel(); }  @Override Channel bind(ServerBootstrap serverBootstrap, DssTcpChannelProperty dssTcpChannelProperty,
        DssTcpChannelInitializer dssTcpChannelInitializer); }
DssTcpChannel implements DssChannel<DssTcpChannelProperty, DssTcpChannelInitializer> { @Override public Channel bind(ServerBootstrap serverBootstrap, DssTcpChannelProperty dssTcpChannelProperty, DssTcpChannelInitializer dssTcpChannelInitializer) throws InterruptedException { Objects.requireNonNull(serverBootstrap); Objects.requireNonNull(dssTcpChannelProperty); Objects.requireNonNull(dssTcpChannelInitializer); return serverBootstrap .channel(NioServerSocketChannel.class) .handler(new LoggingHandler(LogLevel.DEBUG)) .childHandler(dssTcpChannelInitializer) .bind(dssTcpChannelProperty.getHost(), dssTcpChannelProperty.getPort()) .sync() .channel(); }  @Override Channel bind(ServerBootstrap serverBootstrap, DssTcpChannelProperty dssTcpChannelProperty,
        DssTcpChannelInitializer dssTcpChannelInitializer);  }