Code example for InetSocketAddress

0
        try { 
            ServerBootstrap b = new ServerBootstrap();
 
            b.group(group)
             .channel(OioServerSocketChannel.class) 
             .localAddress(new InetSocketAddress(port))
             .childHandler(new ChannelInitializer<SocketChannel>() {
                 @Override 
                 public void initChannel(SocketChannel ch) 
                     throws Exception { 
                     ch.pipeline().addLast(new ChannelInboundHandlerAdapter() {
                         @Override 
                         public void channelActive(ChannelHandlerContext ctx) throws Exception {
                             ctx.write(buf.duplicate()).addListener(ChannelFutureListener.CLOSE);
                         } 
                     }); 
                 } 
             }); 
            ChannelFuture f = b.bind().sync();
            f.channel().closeFuture().sync();
        } finally {