.setFollowRedirect(true)//
.setAcceptAnyCertificate(true)//
.build();
AsyncHttpClient c = getAsyncHttpClient(cg);
try {
Response response = c.prepareGet(getTargetUrl()).setHeader("X-redirect", getTargetUrl2() + "/test2").execute().get();
assertNotNull(response);
assertEquals(response.getStatusCode(), 200);
assertEquals(response.getHeader("X-httpToHttps"), "PASS");
// Test if the internal channel is downgraded to clean http.
response = c.prepareGet(getTargetUrl()).setHeader("X-redirect", getTargetUrl2() + "/foo2").execute().get();
assertNotNull(response);
assertEquals(response.getStatusCode(), 200);
assertEquals(response.getHeader("X-httpToHttps"), "PASS");
} finally {
c.close();
}
}