### Question:
NettyRequest implements RestRequest { protected boolean isKeepAlive() { return HttpUtil.isKeepAlive(request); } NettyRequest(HttpRequest request, Channel channel, NettyMetrics nettyMetrics,
      Set<String> blacklistedQueryParams); @Override String getUri(); @Override String getPath(); @Override RestMethod getRestMethod(); @Override Map<String, Object> getArgs(); @Override Object setArg(String key, Object value); @Override SSLSession getSSLSession(); @Override void prepare(); @Override boolean isOpen(); @Override void close(); @Override RestRequestMetricsTracker getMetricsTracker(); @Override String toString(); @Override long getSize(); @Override Future<Long> readInto(AsyncWritableChannel asyncWritableChannel, Callback<Long> callback); @Override void setDigestAlgorithm(String digestAlgorithm); @Override byte[] getDigest(); @Override long getBytesReceived(); @Override long getBlobBytesReceived(); @Override NettyRequestContext getRestRequestContext();  }### Answer:
@Test public void keepAliveTest() throws RestServiceException { NettyRequest request = createNettyRequest(HttpMethod.GET, "/", null, new MockChannel()); assertTrue("Keep-alive not as expected", request.isKeepAlive()); HttpHeaders headers = new DefaultHttpHeaders(); headers.set(HttpHeaderNames.CONNECTION, HttpHeaderValues.KEEP_ALIVE); request = createNettyRequest(HttpMethod.GET, "/", headers, new MockChannel()); assertTrue("Keep-alive not as expected", request.isKeepAlive()); headers = new DefaultHttpHeaders(); headers.set(HttpHeaderNames.CONNECTION, HttpHeaderValues.CLOSE); request = createNettyRequest(HttpMethod.GET, "/", headers, new MockChannel()); assertFalse("Keep-alive not as expected", request.isKeepAlive()); }