Class HttpClientConfigurator


  • public class HttpClientConfigurator
    extends Object
    Used to preconfigure HttpClient proxy/certificates/authentication
    • Constructor Detail

      • HttpClientConfigurator

        public HttpClientConfigurator()
    • Method Detail

      • configureProxy

        public void configureProxy​(org.apache.http.client.CredentialsProvider credentialsProvider)
        Add corresponding proxy-server settings into specified CredentialsProvider. It uses System or TeamCity properties like:
        
         -Dhttp(s).proxyHost=proxy.domain.com
         -Dhttp(s).proxyPort=8080
         -Dhttp(s).nonProxyHosts=domain.com
        
         teamcity.http(s).proxyHost=proxy.domain.com
         teamcity.http(s).proxyPort=8080
         teamcity.http(s).nonProxyHosts=localhost|*.mydomain.com
         teamcity.http(s).proxyAuthenticationType=basic
         teamcity.http(s).proxyLogin=username
         teamcity.http(s).proxyPassword=password
        Parameters:
        credentialsProvider - provider for configure
      • createSSLSocketFactory

        @NotNull
        @Deprecated
        public org.apache.http.conn.ssl.SSLConnectionSocketFactory createSSLSocketFactory​(@Nullable
                                                                                          KeyStore trustStore,
                                                                                          boolean allowNonSecureConnection)
        Deprecated.
        use createSSLContext / getX509HostnameVerifier instead
        Create SSLConnectionSocketFactory with custom trust store and proper hostname verifier strategy. Not needed for httpclient-4.5 since SNI support is on by default.
        Parameters:
        trustStore - key store with user trusted certificates of null
        allowNonSecureConnection - false if strict hostname verifier have to be used; otherwise true
        Returns:
        not null SSLConnectionSocketFactory
      • createSSLContext

        @Nullable
        public SSLContext createSSLContext​(@Nullable
                                           KeyStore trustStore)
      • getX509HostnameVerifier

        @NotNull
        public org.apache.http.conn.ssl.X509HostnameVerifier getX509HostnameVerifier​(boolean allowNonSecureConnection)