@Test(expected = IOException.class)
public void shouldThrowCosnnectException() throws Exception {

    HttpServer server = HttpServer.create(new InetSocketAddress(10082), 0);
    try {
        server.createContext("/testdb", new MyHandler());
        server.setExecutor(null); // creates a default executor
        server.start();
        InfluxDbHttpSender influxDbHttpSender = new InfluxDbHttpSender(
            "http",
            "localhost",
            10082,
            "testdb",
            "asdf",
            TimeUnit.MINUTES,
            1000,
            1000,
            ""
        );
        influxDbHttpSender.writeData(new byte[0]);
    } catch (IOException e) {
        throw new IOException(e);
    } finally {
        server.stop(0);
    }
}