String cookiePolicy, SSLContext sslContext,
X509HostnameVerifier hostnameVerifier)
{
HttpParams httpParams = new BasicHttpParams();
SchemeRegistry registry = new SchemeRegistry();
registry.register(new Scheme("http", PlainSocketFactory.getSocketFactory(), 80));
SSLSocketFactory sslSocketFactory;
if (null == sslContext)
{
sslSocketFactory = SSLSocketFactory.getSocketFactory();
}
else
{
sslSocketFactory = new SSLSocketFactory(sslContext);
}
if (null != hostnameVerifier)
{
sslSocketFactory.setHostnameVerifier(hostnameVerifier);
}
registry.register(new Scheme("https", sslSocketFactory, 443));
ClientConnectionManager connManager;
if (multiThreadedHttpClient)
connManager = new ThreadSafeClientConnManager(httpParams, registry);
else