JettyDemoServer { public String getUrl() { return getUrl(connector); } JettyDemoServer(); static void main(String[] args); void startConnector(int port); String getUrl(); int getPort();  }
@Test public void shouldStartSuccessfully() throws Exception { URL url = new URL(server.getUrl() + "/demo"); HttpURLConnection connection = (HttpURLConnection) url.openConnection(); assertThat(connection.getResponseCode()) .as(connection.getResponseMessage()) .isEqualTo(200); String body = HttpURLConnectionApiClient.asString(connection.getInputStream()); assertThat(body).contains("<h1>Hello World</h1>"); }