@Test public void finalizeShouldShutdownConnectionManager() throws Throwable { ClientConnectionManager clientConnectionManager = mock(ClientConnectionManager.class); when(client.getConnectionManager()).thenReturn(clientConnectionManager); toTest.finalize(); verify(clientConnectionManager).shutdown(); }
@Override protected void finalize() throws Throwable { try { dispose(); } finally { super.finalize(); } }
HttpClientHttpChannelFactory implements HttpChannelFactory, Disposable { @Override protected void finalize() throws Throwable { try { dispose(); } finally { super.finalize(); } } }
HttpClientHttpChannelFactory implements HttpChannelFactory, Disposable { @Override protected void finalize() throws Throwable { try { dispose(); } finally { super.finalize(); } } HttpClientHttpChannelFactory(HttpClient client);  HttpClientHttpChannelFactory(CRestConfig crestConfig); }
HttpClientHttpChannelFactory implements HttpChannelFactory, Disposable { @Override protected void finalize() throws Throwable { try { dispose(); } finally { super.finalize(); } } HttpClientHttpChannelFactory(HttpClient client);  HttpClientHttpChannelFactory(CRestConfig crestConfig); HttpChannel open(MethodType methodType, String url, Charset charset); void dispose(); }
HttpClientHttpChannelFactory implements HttpChannelFactory, Disposable { @Override protected void finalize() throws Throwable { try { dispose(); } finally { super.finalize(); } } HttpClientHttpChannelFactory(HttpClient client);  HttpClientHttpChannelFactory(CRestConfig crestConfig); HttpChannel open(MethodType methodType, String url, Charset charset); void dispose(); static final String HTTP_CLIENT_PROP; }