@Test public void propagatesQos_503() throws Exception { server.enqueue(new MockResponse().setResponseCode(503)); OkHttpClient client = OkHttpClients.withStableUris( ClientConfiguration.builder() .from(createTestConfig(url)) .serverQoS(ClientConfiguration.ServerQoS.PROPAGATE_429_and_503_TO_CALLER) .build(), hostEventsSink, OkHttpClientsTest.class); Call call = client.newCall(new Request.Builder().url(url).build()); assertThat(call.execute().code()).isEqualTo(503); assertThat(server.getRequestCount()).isEqualTo(1); }
@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);  }