Code example for SSLSocketFactory

Methods: setHostnameVerifier

	private static SSLSocketFactory createFactory(final KeyStore truststore) {
	    SSLSocketFactory factory;
	    try { 
	        factory = new SSLSocketFactory(truststore);
	        factory.setHostnameVerifier((X509HostnameVerifier) SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
	    } catch (Exception e) {
	        throw new RuntimeException(e);
	    return factory;
	private static RestTemplate newRest(final Context ctx) {
		final RestTemplate rest = new RestTemplate(true);
		rest.setRequestFactory(new HttpComponentsClientHttpRequestFactory(getHttpClient(ctx)));
		return rest;
Connect your IDE to all the code out there  Get Codota for Java