DefaultRedirectStrategy redirectStrategy = new DefaultRedirectStrategy();
HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1,
HttpStatus.SC_SEE_OTHER, "Redirect");
response.addHeader("Location", "http://localhost/stuff");
HttpContext context1 = new BasicHttpContext();
HttpUriRequest redirect1 = redirectStrategy.getRedirect(
new HttpGet("http://localhost/"), response, context1);
Assert.assertEquals("GET", redirect1.getMethod());
HttpContext context2 = new BasicHttpContext();
HttpUriRequest redirect2 = redirectStrategy.getRedirect(
new HttpPost("http://localhost/"), response, context2);
Assert.assertEquals("GET", redirect2.getMethod());
HttpContext context3 = new BasicHttpContext();
HttpUriRequest redirect3 = redirectStrategy.getRedirect(
new HttpHead("http://localhost/"), response, context3);
Assert.assertEquals("HEAD", redirect3.getMethod());
}