hcBuilder.setDefaultCredentialsProvider(credsProvider);
// preemptive mode:
if (a.isPreemptive()) {
AuthCache authCache = new BasicAuthCache();
AuthSchemeBase authScheme = a instanceof BasicAuth?
new BasicScheme(): new DigestScheme();
authCache.put(new HttpHost(urlHost, urlPort, urlProtocol), authScheme);
HttpClientContext localContext = HttpClientContext.create();
localContext.setAuthCache(authCache);
httpContext = localContext;