if (endpoint.getProxy() != null) { if ((endpoint.getProxy().getProxyHost() != null) && (endpoint.getProxy().getProxyPort() != 0)) { host.setProxy(endpoint.getProxy().getProxyHost(), endpoint.getProxy().getProxyPort()); } } else if ((getConfiguration().getProxyHost() != null) && (getConfiguration().getProxyPort() != 0)) { host.setProxy(getConfiguration().getProxyHost(), getConfiguration().getProxyPort()); } if (endpoint.getProxy().getProxyCredentials() != null) { endpoint.getProxy().getProxyCredentials().applyProxyCredentials(getClient()); }
    private HostConfiguration getHostConfiguration(String locationURI) throws Exception {        HostConfiguration host;        URI uri = new URI(locationURI, false);        if (uri.getScheme().equals("https")) {            ProtocolSocketFactory sf = new CommonsHttpSSLSocketFactory(                            endpoint.getSsl(),                            endpoint.getKeystoreManager());            Protocol protocol = new Protocol("https", sf, 443);            HttpHost httphost = new HttpHost(uri.getHost(), uri.getPort(), protocol);            host = new HostConfiguration();            host.setHost(httphost);        } else {            host = new HostConfiguration();            host.setHost(uri.getHost(), uri.getPort());        }        return host;    }