42 SSLSocketFactory sf =
new SSLSocketFactory(
new TrustStrategy() {
44 public boolean isTrusted(X509Certificate[] chain, String authType)
throws CertificateException {
47 },
new X509HostnameVerifier() {
49 public void verify(String host, SSLSocket ssl)
throws IOException {
53 public void verify(String host, X509Certificate cert)
throws SSLException {
57 public void verify(String host, String[] cns, String[] subjectAlts)
throws SSLException {
61 public boolean verify(String s, SSLSession sslSession) {
66 SchemeRegistry registry =
new SchemeRegistry();
67 registry.register(
new Scheme(
"http", 80, PlainSocketFactory.getSocketFactory()));
68 registry.register(
new Scheme(
"https", 443, sf));
69 ClientConnectionManager ccm =
new PoolingClientConnectionManager(registry);
70 return new DefaultHttpClient(ccm);