@Test
public void testConnectionKeepAliveForDirectRequests() throws Exception {

    HttpRequest request = new BasicHttpRequest("GET", "/");
    HttpContext context = new BasicHttpContext();
    HttpHost target = new HttpHost("localhost", 80, "http");
    HttpRoute route = new HttpRoute(target, null, false);
    HttpRoutedConnection conn = Mockito.mock(HttpRoutedConnection.class);
    Mockito.when(conn.getRoute()).thenReturn(route);
    context.setAttribute(ExecutionContext.HTTP_CONNECTION, conn);
    HttpRequestInterceptor interceptor = new RequestClientConnControl();
    interceptor.process(request, context);
    Header header1 = request.getFirstHeader(HTTP.CONN_DIRECTIVE);
    Assert.assertNotNull(header1);
    Assert.assertEquals(HTTP.CONN_KEEP_ALIVE, header1.getValue());
    Header header2 = request.getFirstHeader("Proxy-Connection");
    Assert.assertNull(header2);
}