{
if (registration.getAuthenticationMechanism() != null)
{
if (registration.getAuthenticationMechanism().getType() instanceof BasicAuth)
{
BasicAuth basic = (BasicAuth) registration.getAuthenticationMechanism().getType();
//log.info("Setting Basic Auth: " + basic.getUsername());
client.getParams().setAuthenticationPreemptive(true);
client.getState().setCredentials(
//new AuthScope(null, 8080, "Test"),
new AuthScope(AuthScope.ANY),
new UsernamePasswordCredentials(basic.getUsername(), basic.getPassword())
);
}
}
}