@Test public void testFlushAfterGatheredFlush() throws Exception { NioEventLoopGroup group = new NioEventLoopGroup(1); try { ServerBootstrap sb = new ServerBootstrap(); sb.group(group).channel(NioServerSocketChannel.class); sb.childHandler(new ChannelInboundHandlerAdapter() { @Override public void channelActive(final ChannelHandlerContext ctx) throws Exception { ctx.write(Unpooled.wrappedBuffer(new byte[] { 'a' })); ChannelFuture f = ctx.write(Unpooled.wrappedBuffer(new byte[] { 'b' })); f.addListener(new ChannelFutureListener() { @Override public void operationComplete(ChannelFuture future) throws Exception { ctx.writeAndFlush(Unpooled.wrappedBuffer(new byte[]{'c'})); } }); ctx.flush(); } }); SocketAddress address = sb.bind(0).sync().channel().localAddress(); Socket s = new Socket(NetUtil.LOCALHOST, ((InetSocketAddress) address).getPort()); DataInput in = new DataInputStream(s.getInputStream()); byte[] buf = new byte[3]; in.readFully(buf); assertThat(new String(buf, CharsetUtil.US_ASCII), is("abc")); s.close(); } finally { group.shutdownGracefully().sync(); } }
@Override public InetSocketAddress localAddress() { return (InetSocketAddress) super.localAddress(); }
NioSocketChannel extends AbstractNioByteChannel implements io.netty.channel.socket.SocketChannel { @Override public InetSocketAddress localAddress() { return (InetSocketAddress) super.localAddress(); } }
NioSocketChannel extends AbstractNioByteChannel implements io.netty.channel.socket.SocketChannel { @Override public InetSocketAddress localAddress() { return (InetSocketAddress) super.localAddress(); } NioSocketChannel(Channel parent, SocketChannel socket);  NioSocketChannel();  NioSocketChannel(SelectorProvider provider);  NioSocketChannel(SocketChannel socket); }
NioSocketChannel extends AbstractNioByteChannel implements io.netty.channel.socket.SocketChannel { @Override public InetSocketAddress localAddress() { return (InetSocketAddress) super.localAddress(); } NioSocketChannel(Channel parent, SocketChannel socket);  NioSocketChannel();  NioSocketChannel(SelectorProvider provider);  NioSocketChannel(SocketChannel socket); @Override ServerSocketChannel parent(); @Override SocketChannelConfig config(); @Override boolean isActive(); @Override InetSocketAddress localAddress(); @Override InetSocketAddress remoteAddress(); @Override boolean isOutputShutdown(); @Override boolean isInputShutdown(); @Override boolean isShutdown(); @Override ChannelFuture shutdownOutput(); @Override ChannelFuture shutdownOutput(final ChannelPromise promise); @Override ChannelFuture shutdownInput(); @Override ChannelFuture shutdownInput(final ChannelPromise promise); @Override ChannelFuture shutdown(); @Override ChannelFuture shutdown(final ChannelPromise promise); }
NioSocketChannel extends AbstractNioByteChannel implements io.netty.channel.socket.SocketChannel { @Override public InetSocketAddress localAddress() { return (InetSocketAddress) super.localAddress(); } NioSocketChannel(Channel parent, SocketChannel socket);  NioSocketChannel();  NioSocketChannel(SelectorProvider provider);  NioSocketChannel(SocketChannel socket); @Override ServerSocketChannel parent(); @Override SocketChannelConfig config(); @Override boolean isActive(); @Override InetSocketAddress localAddress(); @Override InetSocketAddress remoteAddress(); @Override boolean isOutputShutdown(); @Override boolean isInputShutdown(); @Override boolean isShutdown(); @Override ChannelFuture shutdownOutput(); @Override ChannelFuture shutdownOutput(final ChannelPromise promise); @Override ChannelFuture shutdownInput(); @Override ChannelFuture shutdownInput(final ChannelPromise promise); @Override ChannelFuture shutdown(); @Override ChannelFuture shutdown(final ChannelPromise promise);  }