this.localServer.register("*",
new BasicRedirectService(host, port));
DefaultHttpClient client = new DefaultHttpClient();
HttpContext context = new BasicHttpContext();
List<Header> defaultHeaders = new ArrayList<Header>(1);
defaultHeaders.add(new BasicHeader(HTTP.USER_AGENT, "my-test-client"));
client.getParams().setParameter(ClientPNames.DEFAULT_HEADERS, defaultHeaders);
HttpGet httpget = new HttpGet("/oldlocation/");
HttpResponse response = client.execute(getServerHttp(), httpget, context);
EntityUtils.consume(response.getEntity());
HttpRequest reqWrapper = (HttpRequest) context.getAttribute(
ExecutionContext.HTTP_REQUEST);
Assert.assertEquals(HttpStatus.SC_OK, response.getStatusLine().getStatusCode());
Assert.assertEquals("/newlocation/", reqWrapper.getRequestLine().getUri());