Source:
<code>private static RemotingOkHttpClient createInternal( ClientConfiguration config, UserAgent userAgent, Class<?> serviceClass, boolean randomizeUrlOrder) { OkHttpClient.Builder client = new OkHttpClient.Builder(); TaggedMetricRegistry registry = DefaultTaggedMetricRegistry.getDefault(); UrlSelectorImpl urlSelector = UrlSelectorImpl.createWithFailedUrlCooldown(config.uris(), randomizeUrlOrder, config.failedUrlCooldown()); if (config.meshProxy().isPresent()) { client.addInterceptor(new MeshProxyInterceptor(config.meshProxy().get())); } else { <START> if (config.nodeSelectionStrategy().equals(NodeSelectionStrategy.ROUND_ROBIN)) { <END> client.addInterceptor(RoundRobinUrlInterceptor.create(urlSelector)); } else { client.addInterceptor(CurrentUrlInterceptor.create(urlSelector)); } } client.followRedirects(false); client.sslSocketFactory(config.sslSocketFactory(), config.trustManager()); client.addInterceptor(InstrumentedInterceptor.create(registry, hostMetrics, serviceClass)); client.addInterceptor(OkhttpTraceInterceptor.INSTANCE); client.addInterceptor(UserAgentInterceptor.of(augmentUserAgent(userAgent, serviceClass))); client.connectTimeout(config.connectTimeout().toMillis(), TimeUnit.MILLISECONDS); client.readTimeout(config.readTimeout().toMillis(), TimeUnit.MILLISECONDS); client.writeTimeout(config.writeTimeout().toMillis(), TimeUnit.MILLISECONDS); client.proxySelector(config.proxy()); if (config.proxyCredentials().isPresent()) { BasicCredentials basicCreds = config.proxyCredentials().get(); final String credentials = Credentials.basic(basicCreds.username(), basicCreds.password()); client.proxyAuthenticator((route, response) -> response.request().newBuilder() .header(HttpHeaders.PROXY_AUTHORIZATION, credentials) .build()); } client.connectionSpecs(createConnectionSpecs(config.enableGcmCipherSuites())); client.connectionPool(connectionPool); client.dispatcher(dispatcher); return new RemotingOkHttpClient( client.build(), () -> new ExponentialBackoff(config.maxNumRetries(), config.backoffSlotSize(), new Random()), urlSelector, schedulingExecutor, executionExecutor, largestOf(config.connectTimeout(), config.readTimeout(), config.writeTimeout()) ); }</code><technical_language>if this a switch error-prone validate check enum cases</technical_language>

Target:
private static RemotingOkHttpClient createInternal( ClientConfiguration config, UserAgent userAgent, Class<?> serviceClass, boolean randomizeUrlOrder) { OkHttpClient.Builder client = new OkHttpClient.Builder(); TaggedMetricRegistry registry = DefaultTaggedMetricRegistry.getDefault(); UrlSelectorImpl urlSelector = UrlSelectorImpl.createWithFailedUrlCooldown(config.uris(), randomizeUrlOrder, config.failedUrlCooldown()); if (config.meshProxy().isPresent()) { client.addInterceptor(new MeshProxyInterceptor(config.meshProxy().get())); } else { switch (config.nodeSelectionStrategy()) { case ROUND_ROBIN: client.addInterceptor(RoundRobinUrlInterceptor.create(urlSelector)); break; case PIN_UNTIL_ERROR: client.addInterceptor(CurrentUrlInterceptor.create(urlSelector)); } } client.followRedirects(false); client.sslSocketFactory(config.sslSocketFactory(), config.trustManager()); client.addInterceptor(InstrumentedInterceptor.create(registry, hostMetrics, serviceClass)); client.addInterceptor(OkhttpTraceInterceptor.INSTANCE); client.addInterceptor(UserAgentInterceptor.of(augmentUserAgent(userAgent, serviceClass))); client.connectTimeout(config.connectTimeout().toMillis(), TimeUnit.MILLISECONDS); client.readTimeout(config.readTimeout().toMillis(), TimeUnit.MILLISECONDS); client.writeTimeout(config.writeTimeout().toMillis(), TimeUnit.MILLISECONDS); client.proxySelector(config.proxy()); if (config.proxyCredentials().isPresent()) { BasicCredentials basicCreds = config.proxyCredentials().get(); final String credentials = Credentials.basic(basicCreds.username(), basicCreds.password()); client.proxyAuthenticator((route, response) -> response.request().newBuilder() .header(HttpHeaders.PROXY_AUTHORIZATION, credentials) .build()); } client.connectionSpecs(createConnectionSpecs(config.enableGcmCipherSuites())); client.connectionPool(connectionPool); client.dispatcher(dispatcher); return new RemotingOkHttpClient( client.build(), () -> new ExponentialBackoff(config.maxNumRetries(), config.backoffSlotSize(), new Random()), urlSelector, schedulingExecutor, executionExecutor, largestOf(config.connectTimeout(), config.readTimeout(), config.writeTimeout()) ); }