@Test public void verifyHttpServerAvailable() throws IOException { AppServiceHub serviceHub = Mockito.mock(AppServiceHub.class); HttpService service = new HttpService(serviceHub); try { String url = "http: HttpClient client = HttpClientBuilder.create().build(); HttpResponse response = client.execute(new HttpGet(url)); assertThat(response.getStatusLine().getStatusCode()).isEqualTo(200); assertThat(EntityUtils.toString(response.getEntity())).isEqualTo("World"); } finally { service.destroy(); } }
@SneakyThrows public void destroy() { server.stop(); server.destroy(); }
HttpService extends SingletonSerializeAsToken { @SneakyThrows public void destroy() { server.stop(); server.destroy(); } }
HttpService extends SingletonSerializeAsToken { @SneakyThrows public void destroy() { server.stop(); server.destroy(); } @SneakyThrows  HttpService(AppServiceHub appServiceHub); }
HttpService extends SingletonSerializeAsToken { @SneakyThrows public void destroy() { server.stop(); server.destroy(); } @SneakyThrows  HttpService(AppServiceHub appServiceHub); @SneakyThrows void destroy(); }
HttpService extends SingletonSerializeAsToken { @SneakyThrows public void destroy() { server.stop(); server.destroy(); } @SneakyThrows  HttpService(AppServiceHub appServiceHub); @SneakyThrows void destroy(); static int DEFAULT_PORT; }