Class HttpConfigurationBuilder

java.lang.Object
co.featbit.server.exterior.HttpConfigurationBuilder
All Implemented Interfaces:
HttpConfigFactory

public abstract class HttpConfigurationBuilder extends Object implements HttpConfigFactory
Contains methods for configuring the SDK's networking behavior.

If you want to set non-default values, create a builder with Factory.httpConfigFactory(), change its properties with the methods of this class and pass it to FBConfig.Builder.httpConfigFactory(HttpConfigFactory):


      FBConfig config = new FBConfig.Builder()
                     .httpConfigFactory(Factory.httpConfigFactory()
                             .connectTime(Duration.ofMillis(3000))
                             .httpProxy("my-proxy", 9000))
                     .build();
 

  • Field Details

    • DEFAULT_CONN_TIME

      protected final Duration DEFAULT_CONN_TIME
    • DEFAULT_SOCK_TIME

      protected final Duration DEFAULT_SOCK_TIME
    • connectTime

      protected Duration connectTime
    • socketTime

      protected Duration socketTime
    • proxy

      protected Proxy proxy
    • authenticator

      protected okhttp3.Authenticator authenticator
    • socketFactory

      protected SocketFactory socketFactory
    • sslSocketFactory

      protected SSLSocketFactory sslSocketFactory
    • x509TrustManager

      protected X509TrustManager x509TrustManager
  • Constructor Details

    • HttpConfigurationBuilder

      public HttpConfigurationBuilder()
  • Method Details

    • connectTime

      public HttpConfigurationBuilder connectTime(Duration duration)
      Sets the connection timeout. This is the time allowed for the SDK to make a socket connection to any of API. The default value is 10s
      Parameters:
      duration - the connection timeout; null to use the default
      Returns:
      the builder
    • socketTime

      public HttpConfigurationBuilder socketTime(Duration duration)
      Sets the read and write timeout. This is the time allowed for the SDK to read/write any of API. The default value is 15s
      Parameters:
      duration - the read/write timeout; null to use the default
      Returns:
      the builder
    • httpProxy

      public HttpConfigurationBuilder httpProxy(String proxyHost, int proxyPort)
      Sets an HTTP proxy for making connections to feature flag center
      Parameters:
      proxyHost - the proxy hostname
      proxyPort - the proxy port
      Returns:
      the builder
    • proxy

      public HttpConfigurationBuilder proxy(Proxy proxy)
      Sets a user implementation proxy for making connections to feature flag center
      Parameters:
      proxy - the proxy
      Returns:
      the builder
    • passwordAuthenticator

      public HttpConfigurationBuilder passwordAuthenticator(String userName, String password)
      Sets a basic authentication strategy for use with an HTTP proxy. This has no effect unless a proxy was specified
      Parameters:
      userName - a string
      password - a string
      Returns:
      the builder
    • authenticator

      public HttpConfigurationBuilder authenticator(okhttp3.Authenticator authenticator)
      Sets a user implementation authentication strategy for use with a proxy. This has no effect unless a proxy was specified
      Parameters:
      authenticator - the Authenticator
      Returns:
      the builder
    • socketFactory

      public HttpConfigurationBuilder socketFactory(SocketFactory factory)
      Specifies a custom socket configuration for HTTP connections to feature flag center
      Parameters:
      factory - the socket factory
      Returns:
      the builder
    • sslSocketFactory

      public HttpConfigurationBuilder sslSocketFactory(SSLSocketFactory factory, X509TrustManager trustManager)
      Specifies a custom security configuration for HTTPS connections to feature flag center
      Parameters:
      factory - the SSL socket factory
      trustManager - the trust manager
      Returns:
      the builder