ProxyAuthSecurityHandler proxyAuthSecurityHandler = new ProxyAuthSecurityHandler();
proxyAuthSecurityHandler.setUserName("username");
// oops, forgot to set password!
config.handlers(proxyAuthSecurityHandler);
RestClient client = new RestClient(config);
Resource resource = client.resource(serviceURL);
try {
@SuppressWarnings("unused")
ClientResponse response = resource.get();
fail("should have got a ClientAuthenticationException");
} catch (ClientAuthenticationException e) {
// do nothing
}
}