@Test
  public void keepAliveTest() throws RestServiceException {
    NettyRequest request = createNettyRequest(HttpMethod.GET, "/", null, new MockChannel());
    // by default, keep-alive is true for HTTP 1.1
    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());
  }
Tests different state transitions that can happen with {@link NettyRequest#addContent(HttpContent)} for GET
requests. Some transitions are valid and some should necessarily throw exceptions.
@throws RestServiceException
ambry-rest/src/test/java/com/github/ambry/rest/NettyRequestTest.java