@Test(expectedExceptions = { HttpHostConnectException.class }, expectedExceptionsMessageRegExp = ".* failed: Connection refused \\(Connection refused\\)")

public void testQuit() throws IOException {
    int port = 8181;
    CollectorRegistry registry = new CollectorRegistry();
    PrometheusPullServer exporter = new PrometheusPullServer(port, registry);
    exporter.quit();
    HttpClient client = HttpClientBuilder.create().build();
    HttpGet request = new HttpGet(String.format("http://localhost:%d/metrics", port));
    client.execute(request);
}