code: public static SSLSocketFactory getSocketFactory() throws Exception {
      	final SSLContext context = SSLContext.getInstance("TLS");
      	context.init(null, new X509TrustManager[] {
      		new X509TrustManager() {
      		    //@Override
      		    public void checkClientTrusted(X509Certificate[] arg0,
      			    String arg1) throws CertificateException {
      		    }
  
      		    //@Override
      		    public void checkServerTrusted(X509Certificate[] arg0,
      			    String arg1) throws CertificateException {
      		    }
  
      		    //@Override
      		    public X509Certificate[] getAcceptedIssuers() {
      			return null;
      		    }
  
      		}}, null);
      	return context.getSocketFactory();
          }
docs: convenience function: create a socket factory which
  uses an anything-goes trust manager.
  proposed by Florian Weimar