HostnameVerifier hv = null;
boolean bypassHostnameVerification =
((ClientConfig)request.getAttribute(WinkConfiguration.class))
.getBypassHostnameVerification() && (connection instanceof HttpsURLConnection);
if (bypassHostnameVerification) {
HttpsURLConnection https = ((HttpsURLConnection)connection);
hv = https.getHostnameVerifier();
https.setHostnameVerifier(new HostnameVerifier() {
public boolean verify(String urlHostName, SSLSession session) {
logger.trace("Bypassing hostname verification: URL host is " + urlHostName //$NON-NLS-1$
+ ", SSLSession host is " //$NON-NLS-1$
+ session.getPeerHost());
return true;