HttpClientBuilder basic auth

Depuis HttpClient 4.3, j'ai été en utilisant le HttpClientBuilder. Je suis de la connexion à un service REST qui a l'authentification de base. Je suis en train de les informations d'identification comme suit:

HttpClientBuilder builder = HttpClientBuilder.create();

//Get the client credentials
String username = Config.get(Constants.CONFIG_USERNAME);
String password = Config.get(Constants.CONFIG_PASSWORD);

//If username and password was found, inject the credentials
if (username != null && password != null)
{
    CredentialsProvider provider = new BasicCredentialsProvider();

    //Create the authentication scope
    AuthScope scope = new AuthScope(AuthScope.ANY_HOST, AuthScope.ANY_PORT, AuthScope.ANY_REALM);

    //Create credential pair
    UsernamePasswordCredentials credentials = new UsernamePasswordCredentials(username, password);

    //Inject the credentials
    provider.setCredentials(scope, credentials);

    //Set the default credentials provider
    builder.setDefaultCredentialsProvider(provider);
}

Toutefois, cela ne fonctionne pas (le RESTE du service que j'utilise est de retour 401). Ce qui ne va pas?