Java tutorial
//package com.java2s; import javax.net.ssl.HostnameVerifier; import javax.net.ssl.SSLSession; public class Main { public static HostnameVerifier createSSLHostnameVerifier(final String apiHostname) { HostnameVerifier hostnameVerifier = new HostnameVerifier() { @Override public boolean verify(String hostname, SSLSession session) { //Logcat.d("HostnameVerifier.verify(): " + hostname + " / " + apiHostname); return hostname.equals(apiHostname); } }; return hostnameVerifier; } }