this.target = new HttpHost("localhost", -1, "https");
HttpRoute route = new HttpRoute(this.target, null, new HttpHost("localhost", 8888), true,
TunnelType.TUNNELLED, LayerType.LAYERED);
HttpRoutedConnection conn = Mockito.mock(HttpRoutedConnection.class);
Mockito.when(conn.getRoute()).thenReturn(route);
Mockito.when(conn.isSecure()).thenReturn(Boolean.TRUE);
Mockito.when(conn.getRemoteAddress()).thenReturn(InetAddress.getByName("localhost"));
Mockito.when(conn.getRemotePort()).thenReturn(1234);
HttpContext context = new BasicHttpContext();
context.setAttribute(ExecutionContext.HTTP_TARGET_HOST, this.target);
context.setAttribute(ExecutionContext.HTTP_CONNECTION, conn);
context.setAttribute(ClientContext.COOKIE_STORE, this.cookieStore);