client.getParams().setBooleanParameter(
ClientPNames.REJECT_RELATIVE_REDIRECT, true);
HttpGet httpget = new HttpGet("/oldlocation/");
try {
client.execute(getServerHttp(), httpget);
fail("ClientProtocolException exception should have been thrown");
} catch (ClientProtocolException e) {
assertTrue(e.getCause() instanceof ProtocolException);
// expected
}