@Test public void testClose() { HttpClient mockClient = mock(HttpClient.class); ScheduledExecutorService retryExecutor = mock(ScheduledExecutorService.class); balancingHttpClient = new BalancingHttpClient(serviceBalancer, mockClient, new BalancingHttpClientConfig(), retryExecutor); balancingHttpClient.close(); verify(retryExecutor).shutdown(); verify(retryExecutor).shutdownNow(); verifyNoMoreInteractions(retryExecutor); verify(mockClient).close(); verifyNoMoreInteractions(mockClient, serviceBalancer); }
@Override public void close() { retryExecutor.shutdown(); retryExecutor.shutdownNow(); httpClient.close(); }
BalancingHttpClient implements HttpClient { @Override public void close() { retryExecutor.shutdown(); retryExecutor.shutdownNow(); httpClient.close(); } }
BalancingHttpClient implements HttpClient { @Override public void close() { retryExecutor.shutdown(); retryExecutor.shutdownNow(); httpClient.close(); } @Inject  BalancingHttpClient(@ForBalancingHttpClient HttpServiceBalancer pool,
            @ForBalancingHttpClient HttpClient httpClient,
            BalancingHttpClientConfig config,
            @ForBalancingHttpClient ScheduledExecutorService retryExecutor); @VisibleForTesting  BalancingHttpClient(@ForBalancingHttpClient HttpServiceBalancer pool,
            @ForBalancingHttpClient HttpClient httpClient,
            BalancingHttpClientConfig config,
            @ForBalancingHttpClient ScheduledExecutorService retryExecutor,
            Ticker ticker); }
BalancingHttpClient implements HttpClient { @Override public void close() { retryExecutor.shutdown(); retryExecutor.shutdownNow(); httpClient.close(); } @Inject  BalancingHttpClient(@ForBalancingHttpClient HttpServiceBalancer pool,
            @ForBalancingHttpClient HttpClient httpClient,
            BalancingHttpClientConfig config,
            @ForBalancingHttpClient ScheduledExecutorService retryExecutor); @VisibleForTesting  BalancingHttpClient(@ForBalancingHttpClient HttpServiceBalancer pool,
            @ForBalancingHttpClient HttpClient httpClient,
            BalancingHttpClientConfig config,
            @ForBalancingHttpClient ScheduledExecutorService retryExecutor,
            Ticker ticker); @Override T execute(Request request, ResponseHandler<T, E> responseHandler); @Override HttpResponseFuture<T> executeAsync(Request request, ResponseHandler<T, E> responseHandler); @Flatten @Override RequestStats getStats(); @Managed String dump(); @Managed void dumpStdErr(); @Override void close(); @Override boolean isClosed(); }
BalancingHttpClient implements HttpClient { @Override public void close() { retryExecutor.shutdown(); retryExecutor.shutdownNow(); httpClient.close(); } @Inject  BalancingHttpClient(@ForBalancingHttpClient HttpServiceBalancer pool,
            @ForBalancingHttpClient HttpClient httpClient,
            BalancingHttpClientConfig config,
            @ForBalancingHttpClient ScheduledExecutorService retryExecutor); @VisibleForTesting  BalancingHttpClient(@ForBalancingHttpClient HttpServiceBalancer pool,
            @ForBalancingHttpClient HttpClient httpClient,
            BalancingHttpClientConfig config,
            @ForBalancingHttpClient ScheduledExecutorService retryExecutor,
            Ticker ticker); @Override T execute(Request request, ResponseHandler<T, E> responseHandler); @Override HttpResponseFuture<T> executeAsync(Request request, ResponseHandler<T, E> responseHandler); @Flatten @Override RequestStats getStats(); @Managed String dump(); @Managed void dumpStdErr(); @Override void close(); @Override boolean isClosed();  }