// Install the all-trusting host verifier
HttpsURLConnection.setDefaultHostnameVerifier(allHostsValid);
// For apache http client
Protocol anonhttps = new Protocol("https",
(ProtocolSocketFactory) new AnonymSSLSocketFactory(), 443); //
Protocol.registerProtocol("https", anonhttps);
}