### Question:
NettyTcpServer extends AbstractTcpServer { @Override public void close() { try { if (channel.isOpen()) { channel.close().sync(); } acceptGroup.shutdownGracefully().syncUninterruptibly(); connectGroup.shutdownGracefully().syncUninterruptibly(); } catch (final InterruptedException e) { Thread.currentThread().interrupt(); } } NettyTcpServer(final ChannelFuture bindFuture,
                   final EventLoopGroup acceptGroup,
                   final EventLoopGroup connectGroup); @Override void close(); static NettyTcpServerBuilder builder();  }### Answer:
@Test public void testCloseServer() throws Exception { try (final NettyTcpServer server = givenNettyTcpServerWithTestRequestDataHandler(); final Socket client = new Socket(LOOPBACK, server.getPort())) { await().until(client::isConnected); server.close(); await().until(() -> sendAndReceive(client, TEST_REQUEST), λ -> client.isClosed()); } }