### Question:
NettyServer implements Server { @Override public int getPort() { return ((InetSocketAddress) serverChannel.localAddress()).getPort(); } NettyServer(Responder responder, InetSocketAddress addr);  NettyServer(Responder responder, InetSocketAddress addr, final Consumer<SocketChannel> initializer);  NettyServer(Responder responder, InetSocketAddress addr, final Consumer<SocketChannel> initializer,
      final Consumer<ServerBootstrap> bootStrapInitialzier);  NettyServer(Responder responder, InetSocketAddress addr, final Consumer<SocketChannel> initializer,
      final Consumer<ServerBootstrap> bootStrapInitialzier, EventLoopGroup bossGroup, EventLoopGroup workerGroup,
      EventLoopGroup callerGroup); @Override void start(); @Override void close(); @Override int getPort(); @Override void join(); int getNumActiveConnections();  }### Answer:
@Test public void testBadRequest() throws IOException { int port = server.getPort(); String msg = "GET /status HTTP/1.1\n\n"; InetSocketAddress sockAddr = new InetSocketAddress("127.0.0.1", port); try (Socket sock = new Socket()) { sock.connect(sockAddr); OutputStream out = sock.getOutputStream(); out.write(msg.getBytes(StandardCharsets.UTF_8)); out.flush(); byte[] buf = new byte[2048]; int bytesRead = sock.getInputStream().read(buf); Assert.assertTrue("Connection should have been closed: " + bytesRead, bytesRead == -1); } }