SSLConnectionSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
// Set up connection manager
connectionManager = new PoolingHttpClientConnectionManager();
CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
if (accessUser != null && accessUser.length() > 0 && accessPassword != null)
{
Credentials credentials = new UsernamePasswordCredentials(accessUser, accessPassword);
if (accessRealm != null && accessRealm.length() > 0)
credentialsProvider.setCredentials(new AuthScope(AuthScope.ANY_HOST, AuthScope.ANY_PORT, accessRealm), credentials);
else
credentialsProvider.setCredentials(AuthScope.ANY, credentials);
}
RequestConfig.Builder requestBuilder = RequestConfig.custom()
.setCircularRedirectsAllowed(true)
.setSocketTimeout(socketTimeout)
.setStaleConnectionCheckEnabled(true)
.setExpectContinueEnabled(true)
.setConnectTimeout(connectionTimeout)
.setConnectionRequestTimeout(socketTimeout);
// If there's a proxy, set that too.
if (proxyHost != null && proxyHost.length() > 0)
{
int proxyPortInt;
if (proxyPort != null && proxyPort.length() > 0)
{
try
{
proxyPortInt = Integer.parseInt(proxyPort);
}
catch (NumberFormatException e)
{
throw new ManifoldCFException("Bad number: "+e.getMessage(),e);
}
}
else
proxyPortInt = 8080;
// Configure proxy authentication
if (proxyUsername != null && proxyUsername.length() > 0)
{
if (proxyPassword == null)
proxyPassword = "";
if (proxyDomain == null)
proxyDomain = "";
credentialsProvider.setCredentials(
new AuthScope(proxyHost, proxyPortInt),
new NTCredentials(proxyUsername, proxyPassword, currentHost, proxyDomain));
}
HttpHost proxy = new HttpHost(proxyHost, proxyPortInt);