@Test public void timeouts_set_to_all_zero_should_be_treated_as_infinity() throws Exception { server.enqueue(new MockResponse() .setBodyDelay(Duration.ofSeconds(11).toMillis(), TimeUnit.MILLISECONDS) .setBody("Hello, world!")); OkHttpClient client = OkHttpClients.withStableUris( ClientConfiguration.builder() .from(createTestConfig(url)) .connectTimeout(Duration.ZERO) .readTimeout(Duration.ZERO) .writeTimeout(Duration.ZERO) .maxNumRetries(0) .backoffSlotSize(Duration.ofMillis(10)) .build(), hostEventsSink, OkHttpClientsTest.class); Request request = new Request.Builder().url(url).build(); Response synchronousCall = client.newCall(request).execute(); assertThat(synchronousCall.body().string()).isEqualTo("Hello, world!"); }
@VisibleForTesting static RemotingOkHttpClient withStableUris( ClientConfiguration config, HostEventsSink hostEventsSink, Class<?> serviceClass) { return createInternal( new OkHttpClient.Builder(), ClientConfiguration.builder() .from(config) .hostEventsSink(hostEventsSink) .build(), serviceClass, !RANDOMIZE, !RESHUFFLE, () -> new ExponentialBackoff(config.maxNumRetries(), config.backoffSlotSize())); }
OkHttpClients { @VisibleForTesting static RemotingOkHttpClient withStableUris( ClientConfiguration config, HostEventsSink hostEventsSink, Class<?> serviceClass) { return createInternal( new OkHttpClient.Builder(), ClientConfiguration.builder() .from(config) .hostEventsSink(hostEventsSink) .build(), serviceClass, !RANDOMIZE, !RESHUFFLE, () -> new ExponentialBackoff(config.maxNumRetries(), config.backoffSlotSize())); } }
OkHttpClients { @VisibleForTesting static RemotingOkHttpClient withStableUris( ClientConfiguration config, HostEventsSink hostEventsSink, Class<?> serviceClass) { return createInternal( new OkHttpClient.Builder(), ClientConfiguration.builder() .from(config) .hostEventsSink(hostEventsSink) .build(), serviceClass, !RANDOMIZE, !RESHUFFLE, () -> new ExponentialBackoff(config.maxNumRetries(), config.backoffSlotSize())); } private  OkHttpClients(); }
OkHttpClients { @VisibleForTesting static RemotingOkHttpClient withStableUris( ClientConfiguration config, HostEventsSink hostEventsSink, Class<?> serviceClass) { return createInternal( new OkHttpClient.Builder(), ClientConfiguration.builder() .from(config) .hostEventsSink(hostEventsSink) .build(), serviceClass, !RANDOMIZE, !RESHUFFLE, () -> new ExponentialBackoff(config.maxNumRetries(), config.backoffSlotSize())); } private  OkHttpClients(); static OkHttpClient create(
            ClientConfiguration config, UserAgent userAgent, HostEventsSink hostEventsSink, Class<?> serviceClass); static OkHttpClient create(
            OkHttpClient.Builder client,
            ClientConfiguration config,
            UserAgent userAgent,
            HostEventsSink hostEventsSink,
            Class<?> serviceClass); }
OkHttpClients { @VisibleForTesting static RemotingOkHttpClient withStableUris( ClientConfiguration config, HostEventsSink hostEventsSink, Class<?> serviceClass) { return createInternal( new OkHttpClient.Builder(), ClientConfiguration.builder() .from(config) .hostEventsSink(hostEventsSink) .build(), serviceClass, !RANDOMIZE, !RESHUFFLE, () -> new ExponentialBackoff(config.maxNumRetries(), config.backoffSlotSize())); } private  OkHttpClients(); static OkHttpClient create(
            ClientConfiguration config, UserAgent userAgent, HostEventsSink hostEventsSink, Class<?> serviceClass); static OkHttpClient create(
            OkHttpClient.Builder client,
            ClientConfiguration config,
            UserAgent userAgent,
            HostEventsSink hostEventsSink,
            Class<?> serviceClass);  }