@Test(timeout = 10_000) public void randomizesUrls() throws IOException { boolean server2WasHit = false; server.shutdown(); server2.enqueue(new MockResponse().setResponseCode(200).setBody("foo")); while (!server2WasHit) { OkHttpClient client = OkHttpClients.create( ClientConfiguration.builder() .from(createTestConfig(url, url2)) .maxNumRetries(0) .build(), AGENT, hostEventsSink, OkHttpClientsTest.class); Call call = client.newCall(new Request.Builder().url(url).build()); String response = null; try { response = call.execute().body().string(); } catch (Exception e) { System.out.println("Failed to talk to shutdown server (this is expected with p=1/2)"); assertThat(e.getCause().toString()).contains(Integer.toString(server.getPort())); } if (response != null) { assertThat(response).isEqualTo("foo"); server2WasHit = true; } } }
public static OkHttpClient create( ClientConfiguration config, UserAgent userAgent, HostEventsSink hostEventsSink, Class<?> serviceClass) { return create(new OkHttpClient.Builder(), config, userAgent, hostEventsSink, serviceClass); }
OkHttpClients { public static OkHttpClient create( ClientConfiguration config, UserAgent userAgent, HostEventsSink hostEventsSink, Class<?> serviceClass) { return create(new OkHttpClient.Builder(), config, userAgent, hostEventsSink, serviceClass); } }
OkHttpClients { public static OkHttpClient create( ClientConfiguration config, UserAgent userAgent, HostEventsSink hostEventsSink, Class<?> serviceClass) { return create(new OkHttpClient.Builder(), config, userAgent, hostEventsSink, serviceClass); } private  OkHttpClients(); }
OkHttpClients { public static OkHttpClient create( ClientConfiguration config, UserAgent userAgent, HostEventsSink hostEventsSink, Class<?> serviceClass) { return create(new OkHttpClient.Builder(), config, userAgent, hostEventsSink, serviceClass); } 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 { public static OkHttpClient create( ClientConfiguration config, UserAgent userAgent, HostEventsSink hostEventsSink, Class<?> serviceClass) { return create(new OkHttpClient.Builder(), config, userAgent, hostEventsSink, serviceClass); } 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);  }