InstrumentedHttpClientConnectionManager extends PoolingHttpClientConnectionManager { public static Builder builder(MetricRegistry metricsRegistry) { return new Builder().metricsRegistry(metricsRegistry); } @Deprecated  InstrumentedHttpClientConnectionManager(MetricRegistry metricRegistry); @Deprecated  InstrumentedHttpClientConnectionManager(MetricRegistry metricsRegistry,
                                                   Registry<ConnectionSocketFactory> socketFactoryRegistry); @Deprecated  InstrumentedHttpClientConnectionManager(MetricRegistry metricsRegistry,
                                                   Registry<ConnectionSocketFactory> socketFactoryRegistry,
                                                   long connTTL,
                                                   TimeUnit connTTLTimeUnit); @Deprecated  InstrumentedHttpClientConnectionManager(MetricRegistry metricsRegistry,
                                                   Registry<ConnectionSocketFactory> socketFactoryRegistry,
                                                   HttpConnectionFactory<HttpRoute, ManagedHttpClientConnection>
                                                           connFactory,
                                                   SchemePortResolver schemePortResolver,
                                                   DnsResolver dnsResolver,
                                                   long connTTL,
                                                   TimeUnit connTTLTimeUnit,
                                                   String name); @Deprecated  InstrumentedHttpClientConnectionManager(MetricRegistry metricsRegistry,
                                                   HttpClientConnectionOperator httpClientConnectionOperator,
                                                   HttpConnectionFactory<HttpRoute, ManagedHttpClientConnection>
                                                           connFactory,
                                                   long connTTL,
                                                   TimeUnit connTTLTimeUnit,
                                                   String name); @Override void shutdown(); static Builder builder(MetricRegistry metricsRegistry);  }
@Test public void shouldRemoveGauges() { final InstrumentedHttpClientConnectionManager instrumentedHttpClientConnectionManager = InstrumentedHttpClientConnectionManager.builder(metricRegistry).build(); Assert.assertEquals(4, metricRegistry.getGauges().size()); instrumentedHttpClientConnectionManager.close(); Assert.assertEquals(0, metricRegistry.getGauges().size()); InstrumentedHttpClientConnectionManager.builder(metricRegistry).build().close(); }
@Test public void configurableViaBuilder() { final MetricRegistry registry = Mockito.mock(MetricRegistry.class); InstrumentedHttpClientConnectionManager.builder(registry) .name("some-name") .name("some-other-name") .build() .close(); ArgumentCaptor<String> argumentCaptor = ArgumentCaptor.forClass(String.class); Mockito.verify(registry, Mockito.atLeast(1)).register(argumentCaptor.capture(), any()); assertTrue(argumentCaptor.getValue().contains("some-other-name")); }