@Test public void clientConfigurationCopyConstructor_CopiesAllValues() throws Exception { ClientConfiguration customConfig = new ClientConfiguration(); for (Field field : ClientConfiguration.class.getDeclaredFields()) { if (isStaticField(field)) { continue; } field.setAccessible(true); final Class<?> clzz = field.getType(); if (clzz.isAssignableFrom(int.class) || clzz.isAssignableFrom(long.class)) { field.set(customConfig, Math.abs(RANDOM.nextInt())); } else if (clzz.isAssignableFrom(boolean.class)) { field.set(customConfig, !(Boolean) field.get(customConfig)); } else if (clzz.isAssignableFrom(String.class)) { field.set(customConfig, RandomStringUtils.random(10)); } else if (clzz.isAssignableFrom(RetryPolicy.class)) { field.set(customConfig, CUSTOM_RETRY_POLICY); } else if (clzz.isAssignableFrom(InetAddress.class)) { field.set(customConfig, InetAddress.getLocalHost()); } else if (clzz.isAssignableFrom(Protocol.class)) { if (field.getName().equals("protocol")) { field.set(customConfig, Protocol.HTTP); } else { field.set(customConfig, Protocol.HTTPS); } } else if (clzz.isAssignableFrom(DnsResolver.class)) { field.set(customConfig, new MyCustomDnsResolver()); } else if (clzz.isAssignableFrom(SecureRandom.class)) { field.set(customConfig, new SecureRandom()); } else if (field.getName().equals("headers")) { field.set(customConfig, ImmutableMapParameter.of("foo", "bar")); } else if (clzz.isAssignableFrom(ApacheHttpClientConfig.class)) { customConfig.getApacheHttpClientConfig() .setSslSocketFactory(Mockito.mock(ConnectionSocketFactory.class)); } else if (clzz.isAssignableFrom(List.class)) { field.set(customConfig, new ArrayList<Object>()); } else if (clzz.isAssignableFrom(AtomicReference.class)) { if (field.getName().equals("httpProxyHolder")) { field.set(customConfig, new AtomicReference<ClientConfiguration.URLHolder>(new ClientConfiguration.URLHolder())); } } else if (clzz.isAssignableFrom(TlsKeyManagersProvider.class)) { field.set(customConfig, new SystemPropertyTlsKeyManagersProvider()); } else { throw new RuntimeException( String.format("Field %s of type %s is not supported", field.getName(), field.getType())); } assertNotEquals( String.format("Field %s does not differ from default value", field.getName()), field.get(DEFAULT_CLIENT_CONFIG), field.get(customConfig)); } assertReflectionEquals(customConfig, new ClientConfiguration(customConfig)); }
public ApacheHttpClientConfig getApacheHttpClientConfig() { return apacheHttpClientConfig; }
ClientConfiguration { public ApacheHttpClientConfig getApacheHttpClientConfig() { return apacheHttpClientConfig; } }
ClientConfiguration { public ApacheHttpClientConfig getApacheHttpClientConfig() { return apacheHttpClientConfig; } ClientConfiguration();  ClientConfiguration(ClientConfiguration other); }
ClientConfiguration { public ApacheHttpClientConfig getApacheHttpClientConfig() { return apacheHttpClientConfig; } ClientConfiguration();  ClientConfiguration(ClientConfiguration other); Protocol getProtocol(); void setProtocol(Protocol protocol); ClientConfiguration withProtocol(Protocol protocol); int getMaxConnections(); void setMaxConnections(int maxConnections); ClientConfiguration withMaxConnections(int maxConnections); @Deprecated String getUserAgent(); @Deprecated void setUserAgent(String userAgent); @Deprecated ClientConfiguration withUserAgent(String userAgent); String getUserAgentPrefix(); void setUserAgentPrefix(String prefix); ClientConfiguration withUserAgentPrefix(String prefix); String getUserAgentSuffix(); void setUserAgentSuffix(String suffix); ClientConfiguration withUserAgentSuffix(String suffix); InetAddress getLocalAddress(); void setLocalAddress(InetAddress localAddress); ClientConfiguration withLocalAddress(InetAddress localAddress); Protocol getProxyProtocol(); ClientConfiguration withProxyProtocol(Protocol proxyProtocol); void setProxyProtocol(Protocol proxyProtocol); String getProxyHost(); void setProxyHost(String proxyHost); ClientConfiguration withProxyHost(String proxyHost); int getProxyPort(); void setProxyPort(int proxyPort); ClientConfiguration withProxyPort(int proxyPort); ClientConfiguration withDisableSocketProxy(boolean disableSocketProxy); void setDisableSocketProxy(boolean disableSocketProxy); boolean disableSocketProxy(); String getProxyUsername(); void setProxyUsername(String proxyUsername); ClientConfiguration withProxyUsername(String proxyUsername); String getProxyPassword(); void setProxyPassword(String proxyPassword); ClientConfiguration withProxyPassword(String proxyPassword); String getProxyDomain(); void setProxyDomain(String proxyDomain); ClientConfiguration withProxyDomain(String proxyDomain); String getProxyWorkstation(); void setProxyWorkstation(String proxyWorkstation); ClientConfiguration withProxyWorkstation(String proxyWorkstation); String getNonProxyHosts(); void setNonProxyHosts(String nonProxyHosts); ClientConfiguration withNonProxyHosts(String nonProxyHosts); List<ProxyAuthenticationMethod> getProxyAuthenticationMethods(); void setProxyAuthenticationMethods(List<ProxyAuthenticationMethod> proxyAuthenticationMethods); ClientConfiguration withProxyAuthenticationMethods(List<ProxyAuthenticationMethod> proxyAuthenticationMethods); RetryPolicy getRetryPolicy(); void setRetryPolicy(RetryPolicy retryPolicy); ClientConfiguration withRetryPolicy(RetryPolicy retryPolicy); int getMaxErrorRetry(); void setMaxErrorRetry(int maxErrorRetry); ClientConfiguration withMaxErrorRetry(int maxErrorRetry); int getSocketTimeout(); void setSocketTimeout(int socketTimeout); ClientConfiguration withSocketTimeout(int socketTimeout); int getConnectionTimeout(); void setConnectionTimeout(int connectionTimeout); ClientConfiguration withConnectionTimeout(int connectionTimeout); int getRequestTimeout(); void setRequestTimeout(int requestTimeout); ClientConfiguration withRequestTimeout(int requestTimeout); int getClientExecutionTimeout(); void setClientExecutionTimeout(int clientExecutionTimeout); ClientConfiguration withClientExecutionTimeout(int clientExecutionTimeout); boolean useReaper(); void setUseReaper(boolean use); ClientConfiguration withReaper(boolean use); boolean useThrottledRetries(); void setUseThrottleRetries(boolean use); ClientConfiguration withThrottledRetries(boolean use); void setMaxConsecutiveRetriesBeforeThrottling(int maxConsecutiveRetriesBeforeThrottling); ClientConfiguration withMaxConsecutiveRetriesBeforeThrottling(int maxConsecutiveRetriesBeforeThrottling); int getMaxConsecutiveRetriesBeforeThrottling(); boolean useGzip(); void setUseGzip(boolean use); ClientConfiguration withGzip(boolean use); int[] getSocketBufferSizeHints(); void setSocketBufferSizeHints(int socketSendBufferSizeHint, int socketReceiveBufferSizeHint); ClientConfiguration withSocketBufferSizeHints(int socketSendBufferSizeHint,
                                                         int socketReceiveBufferSizeHint); String getSignerOverride(); void setSignerOverride(final String value); ClientConfiguration withSignerOverride(final String value); boolean isPreemptiveBasicProxyAuth(); void setPreemptiveBasicProxyAuth(Boolean preemptiveBasicProxyAuth); ClientConfiguration withPreemptiveBasicProxyAuth(boolean preemptiveBasicProxyAuth); long getConnectionTTL(); void setConnectionTTL(long connectionTTL); ClientConfiguration withConnectionTTL(long connectionTTL); long getConnectionMaxIdleMillis(); void setConnectionMaxIdleMillis(long connectionMaxIdleMillis); ClientConfiguration withConnectionMaxIdleMillis(long connectionMaxIdleMillis); int getValidateAfterInactivityMillis(); void setValidateAfterInactivityMillis(int validateAfterInactivityMillis); ClientConfiguration withValidateAfterInactivityMillis(int validateAfterInactivityMillis); boolean useTcpKeepAlive(); void setUseTcpKeepAlive(final boolean use); ClientConfiguration withTcpKeepAlive(final boolean use); DnsResolver getDnsResolver(); void setDnsResolver(final DnsResolver resolver); ClientConfiguration withDnsResolver(final DnsResolver resolver); boolean getCacheResponseMetadata(); void setCacheResponseMetadata(boolean shouldCache); ClientConfiguration withCacheResponseMetadata(final boolean shouldCache); int getResponseMetadataCacheSize(); void setResponseMetadataCacheSize(int responseMetadataCacheSize); ClientConfiguration withResponseMetadataCacheSize(int responseMetadataCacheSize); ApacheHttpClientConfig getApacheHttpClientConfig(); SecureRandom getSecureRandom(); void setSecureRandom(SecureRandom secureRandom); ClientConfiguration withSecureRandom(SecureRandom secureRandom); boolean isUseExpectContinue(); void setUseExpectContinue(boolean useExpectContinue); ClientConfiguration withUseExpectContinue(boolean useExpectContinue); ClientConfiguration withHeader(String name, String value); void addHeader(String name, String value); Map<String, String> getHeaders(); boolean isDisableHostPrefixInjection(); void setDisableHostPrefixInjection(boolean disableHostPrefixInjection); ClientConfiguration withDisableHostPrefixInjection(boolean disableHostPrefixInjection); TlsKeyManagersProvider getTlsKeyManagersProvider(); ClientConfiguration withTlsKeyManagersProvider(TlsKeyManagersProvider tlsKeyManagersProvider); void setTlsKeyManagersProvider(TlsKeyManagersProvider tlsKeyManagersProvider); }
ClientConfiguration { public ApacheHttpClientConfig getApacheHttpClientConfig() { return apacheHttpClientConfig; } ClientConfiguration();  ClientConfiguration(ClientConfiguration other); Protocol getProtocol(); void setProtocol(Protocol protocol); ClientConfiguration withProtocol(Protocol protocol); int getMaxConnections(); void setMaxConnections(int maxConnections); ClientConfiguration withMaxConnections(int maxConnections); @Deprecated String getUserAgent(); @Deprecated void setUserAgent(String userAgent); @Deprecated ClientConfiguration withUserAgent(String userAgent); String getUserAgentPrefix(); void setUserAgentPrefix(String prefix); ClientConfiguration withUserAgentPrefix(String prefix); String getUserAgentSuffix(); void setUserAgentSuffix(String suffix); ClientConfiguration withUserAgentSuffix(String suffix); InetAddress getLocalAddress(); void setLocalAddress(InetAddress localAddress); ClientConfiguration withLocalAddress(InetAddress localAddress); Protocol getProxyProtocol(); ClientConfiguration withProxyProtocol(Protocol proxyProtocol); void setProxyProtocol(Protocol proxyProtocol); String getProxyHost(); void setProxyHost(String proxyHost); ClientConfiguration withProxyHost(String proxyHost); int getProxyPort(); void setProxyPort(int proxyPort); ClientConfiguration withProxyPort(int proxyPort); ClientConfiguration withDisableSocketProxy(boolean disableSocketProxy); void setDisableSocketProxy(boolean disableSocketProxy); boolean disableSocketProxy(); String getProxyUsername(); void setProxyUsername(String proxyUsername); ClientConfiguration withProxyUsername(String proxyUsername); String getProxyPassword(); void setProxyPassword(String proxyPassword); ClientConfiguration withProxyPassword(String proxyPassword); String getProxyDomain(); void setProxyDomain(String proxyDomain); ClientConfiguration withProxyDomain(String proxyDomain); String getProxyWorkstation(); void setProxyWorkstation(String proxyWorkstation); ClientConfiguration withProxyWorkstation(String proxyWorkstation); String getNonProxyHosts(); void setNonProxyHosts(String nonProxyHosts); ClientConfiguration withNonProxyHosts(String nonProxyHosts); List<ProxyAuthenticationMethod> getProxyAuthenticationMethods(); void setProxyAuthenticationMethods(List<ProxyAuthenticationMethod> proxyAuthenticationMethods); ClientConfiguration withProxyAuthenticationMethods(List<ProxyAuthenticationMethod> proxyAuthenticationMethods); RetryPolicy getRetryPolicy(); void setRetryPolicy(RetryPolicy retryPolicy); ClientConfiguration withRetryPolicy(RetryPolicy retryPolicy); int getMaxErrorRetry(); void setMaxErrorRetry(int maxErrorRetry); ClientConfiguration withMaxErrorRetry(int maxErrorRetry); int getSocketTimeout(); void setSocketTimeout(int socketTimeout); ClientConfiguration withSocketTimeout(int socketTimeout); int getConnectionTimeout(); void setConnectionTimeout(int connectionTimeout); ClientConfiguration withConnectionTimeout(int connectionTimeout); int getRequestTimeout(); void setRequestTimeout(int requestTimeout); ClientConfiguration withRequestTimeout(int requestTimeout); int getClientExecutionTimeout(); void setClientExecutionTimeout(int clientExecutionTimeout); ClientConfiguration withClientExecutionTimeout(int clientExecutionTimeout); boolean useReaper(); void setUseReaper(boolean use); ClientConfiguration withReaper(boolean use); boolean useThrottledRetries(); void setUseThrottleRetries(boolean use); ClientConfiguration withThrottledRetries(boolean use); void setMaxConsecutiveRetriesBeforeThrottling(int maxConsecutiveRetriesBeforeThrottling); ClientConfiguration withMaxConsecutiveRetriesBeforeThrottling(int maxConsecutiveRetriesBeforeThrottling); int getMaxConsecutiveRetriesBeforeThrottling(); boolean useGzip(); void setUseGzip(boolean use); ClientConfiguration withGzip(boolean use); int[] getSocketBufferSizeHints(); void setSocketBufferSizeHints(int socketSendBufferSizeHint, int socketReceiveBufferSizeHint); ClientConfiguration withSocketBufferSizeHints(int socketSendBufferSizeHint,
                                                         int socketReceiveBufferSizeHint); String getSignerOverride(); void setSignerOverride(final String value); ClientConfiguration withSignerOverride(final String value); boolean isPreemptiveBasicProxyAuth(); void setPreemptiveBasicProxyAuth(Boolean preemptiveBasicProxyAuth); ClientConfiguration withPreemptiveBasicProxyAuth(boolean preemptiveBasicProxyAuth); long getConnectionTTL(); void setConnectionTTL(long connectionTTL); ClientConfiguration withConnectionTTL(long connectionTTL); long getConnectionMaxIdleMillis(); void setConnectionMaxIdleMillis(long connectionMaxIdleMillis); ClientConfiguration withConnectionMaxIdleMillis(long connectionMaxIdleMillis); int getValidateAfterInactivityMillis(); void setValidateAfterInactivityMillis(int validateAfterInactivityMillis); ClientConfiguration withValidateAfterInactivityMillis(int validateAfterInactivityMillis); boolean useTcpKeepAlive(); void setUseTcpKeepAlive(final boolean use); ClientConfiguration withTcpKeepAlive(final boolean use); DnsResolver getDnsResolver(); void setDnsResolver(final DnsResolver resolver); ClientConfiguration withDnsResolver(final DnsResolver resolver); boolean getCacheResponseMetadata(); void setCacheResponseMetadata(boolean shouldCache); ClientConfiguration withCacheResponseMetadata(final boolean shouldCache); int getResponseMetadataCacheSize(); void setResponseMetadataCacheSize(int responseMetadataCacheSize); ClientConfiguration withResponseMetadataCacheSize(int responseMetadataCacheSize); ApacheHttpClientConfig getApacheHttpClientConfig(); SecureRandom getSecureRandom(); void setSecureRandom(SecureRandom secureRandom); ClientConfiguration withSecureRandom(SecureRandom secureRandom); boolean isUseExpectContinue(); void setUseExpectContinue(boolean useExpectContinue); ClientConfiguration withUseExpectContinue(boolean useExpectContinue); ClientConfiguration withHeader(String name, String value); void addHeader(String name, String value); Map<String, String> getHeaders(); boolean isDisableHostPrefixInjection(); void setDisableHostPrefixInjection(boolean disableHostPrefixInjection); ClientConfiguration withDisableHostPrefixInjection(boolean disableHostPrefixInjection); TlsKeyManagersProvider getTlsKeyManagersProvider(); ClientConfiguration withTlsKeyManagersProvider(TlsKeyManagersProvider tlsKeyManagersProvider); void setTlsKeyManagersProvider(TlsKeyManagersProvider tlsKeyManagersProvider); static final int DEFAULT_CONNECTION_TIMEOUT; static final int DEFAULT_SOCKET_TIMEOUT; static final int DEFAULT_REQUEST_TIMEOUT; static final int DEFAULT_CLIENT_EXECUTION_TIMEOUT; static final boolean DEFAULT_DISABLE_SOCKET_PROXY; static final int DEFAULT_MAX_CONNECTIONS; static final boolean DEFAULT_USE_EXPECT_CONTINUE; static final String DEFAULT_USER_AGENT; static final RetryPolicy DEFAULT_RETRY_POLICY; static final boolean DEFAULT_USE_REAPER; static final boolean DEFAULT_USE_GZIP; static final long DEFAULT_CONNECTION_TTL; static final long DEFAULT_CONNECTION_MAX_IDLE_MILLIS; static final int DEFAULT_VALIDATE_AFTER_INACTIVITY_MILLIS; static final boolean DEFAULT_TCP_KEEP_ALIVE; static final boolean DEFAULT_THROTTLE_RETRIES; static final boolean DEFAULT_CACHE_RESPONSE_METADATA; static final int DEFAULT_RESPONSE_METADATA_CACHE_SIZE; static final int DEFAULT_MAX_CONSECUTIVE_RETRIES_BEFORE_THROTTLING; }