InfluxDbUdpSender extends InfluxDbBaseSender { @Override protected int writeData(byte[] line) throws Exception { createSocket(); udpSocket.send(new DatagramPacket(line, line.length, InetAddress.getByName(hostname), port)); return 0; } InfluxDbUdpSender(
        String hostname,
        int port,
        int socketTimeout,
        String database,
        String measurementPrefix);   }
@Test(expected = UnknownHostException.class) public void shouldThrowUnknownHostException() throws Exception { InfluxDbUdpSender influxDbUdpSender = new InfluxDbUdpSender( "testtestasdfg", 10080, 1000, "test", "" ); influxDbUdpSender.writeData(new byte[0]); }
@Test public void shouldNotThrowException() throws Exception { InfluxDbUdpSender influxDbUdpSender = new InfluxDbUdpSender( "localhost", 10080, 1000, "test", "" ); assertThat(influxDbUdpSender.writeData(new byte[0]) == 0); }