@Test public void verifyNodeSeletionStrategy_pinUntilErrorUsesCurrentUrl() throws Exception { server.enqueue(new MockResponse().setBody("foo")); server.enqueue(new MockResponse().setBody("bar")); OkHttpClient client = OkHttpClients.withStableUris( ClientConfiguration.builder() .from(createTestConfig(url, url2, url3)) .nodeSelectionStrategy(NodeSelectionStrategy.PIN_UNTIL_ERROR) .build(), hostEventsSink, OkHttpClientsTest.class); Call call = client.newCall(new Request.Builder().url(url + "/foo?bar").build()); assertThat(call.execute().body().string()).isEqualTo("foo"); Call call2 = client.newCall(new Request.Builder().url(url + "/foo?bar").build()); assertThat(call2.execute().body().string()).isEqualTo("bar"); assertThat(server.takeRequest().getPath()).isEqualTo("/foo?bar"); assertThat(server.takeRequest().getPath()).isEqualTo("/foo?bar"); }
@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);  }