@Test(timeout = 3000) public void testShutdownOutputAndClose() throws IOException { NioEventLoopGroup group = new NioEventLoopGroup(1); ServerSocket socket = new ServerSocket(); socket.bind(new InetSocketAddress(0)); Socket accepted = null; try { Bootstrap sb = new Bootstrap(); sb.group(group).channel(NioSocketChannel.class); sb.handler(new ChannelInboundHandlerAdapter()); SocketChannel channel = (SocketChannel) sb.connect(socket.getLocalSocketAddress()) .syncUninterruptibly().channel(); accepted = socket.accept(); channel.shutdownOutput().syncUninterruptibly(); channel.close().syncUninterruptibly(); } finally { if (accepted != null) { try { accepted.close(); } catch (IOException ignore) { } } try { socket.close(); } catch (IOException ignore) { } group.shutdownGracefully(); } }
@Override public ChannelFuture shutdownOutput() { return shutdownOutput(newPromise()); }
NioSocketChannel extends AbstractNioByteChannel implements io.netty.channel.socket.SocketChannel { @Override public ChannelFuture shutdownOutput() { return shutdownOutput(newPromise()); } }
NioSocketChannel extends AbstractNioByteChannel implements io.netty.channel.socket.SocketChannel { @Override public ChannelFuture shutdownOutput() { return shutdownOutput(newPromise()); } NioSocketChannel(Channel parent, SocketChannel socket);  NioSocketChannel();  NioSocketChannel(SelectorProvider provider);  NioSocketChannel(SocketChannel socket); }
NioSocketChannel extends AbstractNioByteChannel implements io.netty.channel.socket.SocketChannel { @Override public ChannelFuture shutdownOutput() { return shutdownOutput(newPromise()); } 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 ChannelFuture shutdownOutput() { return shutdownOutput(newPromise()); } 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);  }