int port = address.getPort();
String host = address.getHostName();
this.localServer.register("*", new RelativeRedirectService());
DefaultHttpClient client = new DefaultHttpClient();
HttpContext context = new BasicHttpContext();
client.getParams().setBooleanParameter(
ClientPNames.REJECT_RELATIVE_REDIRECT, false);
HttpGet httpget = new HttpGet("/oldlocation/");
HttpResponse response = client.execute(getServerHttp(), httpget, context);
EntityUtils.consume(response.getEntity());
HttpRequest reqWrapper = (HttpRequest) context.getAttribute(
ExecutionContext.HTTP_REQUEST);
HttpHost targetHost = (HttpHost) context.getAttribute(
ExecutionContext.HTTP_TARGET_HOST);
Assert.assertEquals(HttpStatus.SC_OK, response.getStatusLine().getStatusCode());
Assert.assertEquals("/relativelocation/", reqWrapper.getRequestLine().getUri());
Assert.assertEquals(host, targetHost.getHostName());