try {
final URI uri = URI.create(uriStr);
final String user = username;
final String pass = password;
final CredentialsCollector credentialsCollector =
new CredentialsCollector() {
public UsernamePasswordCredentials
getBasicAuthenticationCredentials(
final String authenticatedEntityID,
final Hashtable properties) {
return new UsernamePasswordCredentials(user, pass);