@Override
    public ChannelFuture shutdownOutput() {
        return shutdownOutput(newPromise());
    }
@Test
    @Timeout(value = 3000, unit = TimeUnit.MILLISECONDS)
    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) {
                    // ignore
                }
            }
            try {
                socket.close();
            } catch (IOException ignore) {
                // ignore
            }
            group.shutdownGracefully();
        }
    }