RestartableHttpClient implements HttpClient { public void restart() { HttpClient old = underlying.get(); if (old != null) { old.getConnectionManager().shutdown(); } setup(); } RestartableHttpClient(Authentication auth, boolean enableGZip, HttpParams params, SchemeRegistry schemeRegistry); void setup(); void restart(); @Override HttpParams getParams(); @Override ClientConnectionManager getConnectionManager(); @Override HttpResponse execute(HttpUriRequest request); @Override HttpResponse execute(HttpUriRequest request, HttpContext context); @Override HttpResponse execute(HttpHost target, HttpRequest request); @Override HttpResponse execute(HttpHost target, HttpRequest request, HttpContext context); @Override T execute(HttpUriRequest request, ResponseHandler<? extends T> responseHandler); @Override T execute(HttpUriRequest request, ResponseHandler<? extends T> responseHandler, HttpContext context); @Override T execute(HttpHost target, HttpRequest request, ResponseHandler<? extends T> responseHandler); @Override T execute(HttpHost target, HttpRequest request, ResponseHandler<? extends T> responseHandler, HttpContext context);  }
@Test public void testRestart() throws Exception { RestartableHttpClient client = new RestartableHttpClient(mockAuth, true, mockParams, defaultSchemeRegistry); client.setup(); client.restart(); try { client.execute(request); fail("should not reach here"); } catch (UnknownHostException e) { } }