@Test public void meshProxy_exactlyOneUri() throws Exception { assertThatThrownBy(() -> ClientConfigurations.of(meshProxyServiceConfig(ImmutableList.of("uri1", "uri2"), 0))) .isInstanceOf(IllegalArgumentException.class) .hasMessage("If meshProxy is configured then uris must contain exactly 1 URI"); }
public static ClientConfiguration of(ServiceConfiguration config) { return ClientConfiguration.builder() .sslSocketFactory(SslSocketFactories.createSslSocketFactory(config.security())) .trustManager(SslSocketFactories.createX509TrustManager(config.security())) .uris(config.uris()) .connectTimeout(config.connectTimeout().orElse(DEFAULT_CONNECT_TIMEOUT)) .readTimeout(config.readTimeout().orElse(DEFAULT_READ_TIMEOUT)) .writeTimeout(config.writeTimeout().orElse(DEFAULT_WRITE_TIMEOUT)) .enableGcmCipherSuites(config.enableGcmCipherSuites().orElse(DEFAULT_ENABLE_GCM_CIPHERS)) .fallbackToCommonNameVerification( config.fallbackToCommonNameVerification().orElse(DEFAULT_FALLBACK_TO_COMMON_NAME_VERIFICATION)) .proxy(config.proxy() .map(ClientConfigurations::createProxySelector) .orElseGet(ProxySelector::getDefault)) .proxyCredentials(config.proxy().flatMap(ProxyConfiguration::credentials)) .meshProxy(meshProxy(config.proxy())) .maxNumRetries(config.maxNumRetries().orElse(DEFAULT_MAX_NUM_RETRIES)) .nodeSelectionStrategy(DEFAULT_NODE_SELECTION_STRATEGY) .failedUrlCooldown(DEFAULT_FAILED_URL_COOLDOWN) .backoffSlotSize(config.backoffSlotSize().orElse(DEFAULT_BACKOFF_SLOT_SIZE)) .clientQoS(CLIENT_QOS_DEFAULT) .serverQoS(PROPAGATE_QOS_DEFAULT) .retryOnTimeout(RETRY_ON_TIMEOUT_DEFAULT) .retryOnSocketException(RETRY_ON_SOCKET_EXCEPTION_DEFAULT) .taggedMetricRegistry(SharedTaggedMetricRegistries.getSingleton()) .build(); }
ClientConfigurations { public static ClientConfiguration of(ServiceConfiguration config) { return ClientConfiguration.builder() .sslSocketFactory(SslSocketFactories.createSslSocketFactory(config.security())) .trustManager(SslSocketFactories.createX509TrustManager(config.security())) .uris(config.uris()) .connectTimeout(config.connectTimeout().orElse(DEFAULT_CONNECT_TIMEOUT)) .readTimeout(config.readTimeout().orElse(DEFAULT_READ_TIMEOUT)) .writeTimeout(config.writeTimeout().orElse(DEFAULT_WRITE_TIMEOUT)) .enableGcmCipherSuites(config.enableGcmCipherSuites().orElse(DEFAULT_ENABLE_GCM_CIPHERS)) .fallbackToCommonNameVerification( config.fallbackToCommonNameVerification().orElse(DEFAULT_FALLBACK_TO_COMMON_NAME_VERIFICATION)) .proxy(config.proxy() .map(ClientConfigurations::createProxySelector) .orElseGet(ProxySelector::getDefault)) .proxyCredentials(config.proxy().flatMap(ProxyConfiguration::credentials)) .meshProxy(meshProxy(config.proxy())) .maxNumRetries(config.maxNumRetries().orElse(DEFAULT_MAX_NUM_RETRIES)) .nodeSelectionStrategy(DEFAULT_NODE_SELECTION_STRATEGY) .failedUrlCooldown(DEFAULT_FAILED_URL_COOLDOWN) .backoffSlotSize(config.backoffSlotSize().orElse(DEFAULT_BACKOFF_SLOT_SIZE)) .clientQoS(CLIENT_QOS_DEFAULT) .serverQoS(PROPAGATE_QOS_DEFAULT) .retryOnTimeout(RETRY_ON_TIMEOUT_DEFAULT) .retryOnSocketException(RETRY_ON_SOCKET_EXCEPTION_DEFAULT) .taggedMetricRegistry(SharedTaggedMetricRegistries.getSingleton()) .build(); } }
ClientConfigurations { public static ClientConfiguration of(ServiceConfiguration config) { return ClientConfiguration.builder() .sslSocketFactory(SslSocketFactories.createSslSocketFactory(config.security())) .trustManager(SslSocketFactories.createX509TrustManager(config.security())) .uris(config.uris()) .connectTimeout(config.connectTimeout().orElse(DEFAULT_CONNECT_TIMEOUT)) .readTimeout(config.readTimeout().orElse(DEFAULT_READ_TIMEOUT)) .writeTimeout(config.writeTimeout().orElse(DEFAULT_WRITE_TIMEOUT)) .enableGcmCipherSuites(config.enableGcmCipherSuites().orElse(DEFAULT_ENABLE_GCM_CIPHERS)) .fallbackToCommonNameVerification( config.fallbackToCommonNameVerification().orElse(DEFAULT_FALLBACK_TO_COMMON_NAME_VERIFICATION)) .proxy(config.proxy() .map(ClientConfigurations::createProxySelector) .orElseGet(ProxySelector::getDefault)) .proxyCredentials(config.proxy().flatMap(ProxyConfiguration::credentials)) .meshProxy(meshProxy(config.proxy())) .maxNumRetries(config.maxNumRetries().orElse(DEFAULT_MAX_NUM_RETRIES)) .nodeSelectionStrategy(DEFAULT_NODE_SELECTION_STRATEGY) .failedUrlCooldown(DEFAULT_FAILED_URL_COOLDOWN) .backoffSlotSize(config.backoffSlotSize().orElse(DEFAULT_BACKOFF_SLOT_SIZE)) .clientQoS(CLIENT_QOS_DEFAULT) .serverQoS(PROPAGATE_QOS_DEFAULT) .retryOnTimeout(RETRY_ON_TIMEOUT_DEFAULT) .retryOnSocketException(RETRY_ON_SOCKET_EXCEPTION_DEFAULT) .taggedMetricRegistry(SharedTaggedMetricRegistries.getSingleton()) .build(); } private  ClientConfigurations(); }
ClientConfigurations { public static ClientConfiguration of(ServiceConfiguration config) { return ClientConfiguration.builder() .sslSocketFactory(SslSocketFactories.createSslSocketFactory(config.security())) .trustManager(SslSocketFactories.createX509TrustManager(config.security())) .uris(config.uris()) .connectTimeout(config.connectTimeout().orElse(DEFAULT_CONNECT_TIMEOUT)) .readTimeout(config.readTimeout().orElse(DEFAULT_READ_TIMEOUT)) .writeTimeout(config.writeTimeout().orElse(DEFAULT_WRITE_TIMEOUT)) .enableGcmCipherSuites(config.enableGcmCipherSuites().orElse(DEFAULT_ENABLE_GCM_CIPHERS)) .fallbackToCommonNameVerification( config.fallbackToCommonNameVerification().orElse(DEFAULT_FALLBACK_TO_COMMON_NAME_VERIFICATION)) .proxy(config.proxy() .map(ClientConfigurations::createProxySelector) .orElseGet(ProxySelector::getDefault)) .proxyCredentials(config.proxy().flatMap(ProxyConfiguration::credentials)) .meshProxy(meshProxy(config.proxy())) .maxNumRetries(config.maxNumRetries().orElse(DEFAULT_MAX_NUM_RETRIES)) .nodeSelectionStrategy(DEFAULT_NODE_SELECTION_STRATEGY) .failedUrlCooldown(DEFAULT_FAILED_URL_COOLDOWN) .backoffSlotSize(config.backoffSlotSize().orElse(DEFAULT_BACKOFF_SLOT_SIZE)) .clientQoS(CLIENT_QOS_DEFAULT) .serverQoS(PROPAGATE_QOS_DEFAULT) .retryOnTimeout(RETRY_ON_TIMEOUT_DEFAULT) .retryOnSocketException(RETRY_ON_SOCKET_EXCEPTION_DEFAULT) .taggedMetricRegistry(SharedTaggedMetricRegistries.getSingleton()) .build(); } private  ClientConfigurations(); static ClientConfiguration of(ServiceConfiguration config); static ClientConfiguration of(
            List<String> uris, SSLSocketFactory sslSocketFactory, X509TrustManager trustManager); static ClientConfiguration of(
            List<String> uris, SSLSocketFactory sslSocketFactory, X509TrustManager trustManager, UserAgent userAgent); static ProxySelector createProxySelector(ProxyConfiguration proxyConfig); }
ClientConfigurations { public static ClientConfiguration of(ServiceConfiguration config) { return ClientConfiguration.builder() .sslSocketFactory(SslSocketFactories.createSslSocketFactory(config.security())) .trustManager(SslSocketFactories.createX509TrustManager(config.security())) .uris(config.uris()) .connectTimeout(config.connectTimeout().orElse(DEFAULT_CONNECT_TIMEOUT)) .readTimeout(config.readTimeout().orElse(DEFAULT_READ_TIMEOUT)) .writeTimeout(config.writeTimeout().orElse(DEFAULT_WRITE_TIMEOUT)) .enableGcmCipherSuites(config.enableGcmCipherSuites().orElse(DEFAULT_ENABLE_GCM_CIPHERS)) .fallbackToCommonNameVerification( config.fallbackToCommonNameVerification().orElse(DEFAULT_FALLBACK_TO_COMMON_NAME_VERIFICATION)) .proxy(config.proxy() .map(ClientConfigurations::createProxySelector) .orElseGet(ProxySelector::getDefault)) .proxyCredentials(config.proxy().flatMap(ProxyConfiguration::credentials)) .meshProxy(meshProxy(config.proxy())) .maxNumRetries(config.maxNumRetries().orElse(DEFAULT_MAX_NUM_RETRIES)) .nodeSelectionStrategy(DEFAULT_NODE_SELECTION_STRATEGY) .failedUrlCooldown(DEFAULT_FAILED_URL_COOLDOWN) .backoffSlotSize(config.backoffSlotSize().orElse(DEFAULT_BACKOFF_SLOT_SIZE)) .clientQoS(CLIENT_QOS_DEFAULT) .serverQoS(PROPAGATE_QOS_DEFAULT) .retryOnTimeout(RETRY_ON_TIMEOUT_DEFAULT) .retryOnSocketException(RETRY_ON_SOCKET_EXCEPTION_DEFAULT) .taggedMetricRegistry(SharedTaggedMetricRegistries.getSingleton()) .build(); } private  ClientConfigurations(); static ClientConfiguration of(ServiceConfiguration config); static ClientConfiguration of(
            List<String> uris, SSLSocketFactory sslSocketFactory, X509TrustManager trustManager); static ClientConfiguration of(
            List<String> uris, SSLSocketFactory sslSocketFactory, X509TrustManager trustManager, UserAgent userAgent); static ProxySelector createProxySelector(ProxyConfiguration proxyConfig);  }