InstrumentedOkHttpClients { public static OkHttpClient create(MetricRegistry registry) { return new InstrumentedOkHttpClient(registry, new OkHttpClient(), null); } private  InstrumentedOkHttpClients(); static OkHttpClient create(MetricRegistry registry); static OkHttpClient create(MetricRegistry registry, OkHttpClient client); static OkHttpClient create(MetricRegistry registry, String name); static OkHttpClient create(MetricRegistry registry, OkHttpClient client, String name);  }
@Test public void instrumentDefaultClient() { OkHttpClient client = InstrumentedOkHttpClients.create(registry); assertThat(client.connectTimeoutMillis()).isEqualTo(10_000); assertThat(client.readTimeoutMillis()).isEqualTo(10_000); assertThat(client.writeTimeoutMillis()).isEqualTo(10_000); }
@Test public void instrumentAndNameDefaultClient() { OkHttpClient client = InstrumentedOkHttpClients.create(registry, "custom"); assertThat(client.connectTimeoutMillis()).isEqualTo(10_000); assertThat(client.readTimeoutMillis()).isEqualTo(10_000); assertThat(client.writeTimeoutMillis()).isEqualTo(10_000); }
@Test public void instrumentProvidedClient() { OkHttpClient rawClient = new OkHttpClient(); OkHttpClient client = InstrumentedOkHttpClients.create(registry, rawClient); assertThatClientsAreEqual(client, rawClient); }
@Test public void instrumentAndNameProvidedClient() { OkHttpClient rawClient = new OkHttpClient(); OkHttpClient client = InstrumentedOkHttpClients.create(registry, rawClient, "custom"); assertThatClientsAreEqual(client, rawClient); }