}
if (isTrusted(host)) {
// creating a special configuration that allows connections to non-trusted HTTPS hosts
// see the javadoc to EasySSLProtocolSocketFactory for details
Protocol easyHttps = new Protocol("https", (ProtocolSocketFactory)new EasySSLProtocolSocketFactory(), 443);
HostConfiguration hc = new HostConfiguration();
hc.setHost(host, 443, easyHttps);
String relativeUri = new URI(uri.getPathQuery(), false).getURI();
// it is important to use relative URI here, otherwise our custom protocol won't work.
// we have to recreate the method, because HttpMethod#setUri won't overwrite the host,