GroupedInfluxDbHttpSender extends InfluxDbHttpSender { @Override public int writeData() throws Exception { InfluxDbWriteObjectSerializer serializer = this.getSerializer(); InfluxDbWriteObject writeObject = this.getWriteObject(); String linestr = serializer.getGroupedLineProtocolString(writeObject, groupMeasurement); final byte[] line = linestr.getBytes(UTF_8); return super.writeData(line); } GroupedInfluxDbHttpSender(String protocol, String hostname, int port, String database, String authString,
            TimeUnit timePrecision, int connectTimeout, int readTimeout, String measurementPrefix, String groupMeasurement); @Override int writeData();  }
@Test public void shouldNotThrowException() throws Exception { HttpServer server = HttpServer.create(new InetSocketAddress(10085), 0); try { server.createContext("/write", new MyHandler()); server.setExecutor(null); server.start(); InfluxDbHttpSender influxDbHttpSender = new GroupedInfluxDbHttpSender( "http", "localhost", 10085, "testdb", "asdf", TimeUnit.MINUTES, 1000, 1000, "", "MyGroup" ); assertThat(influxDbHttpSender.getSerializer() != null); assertThat(influxDbHttpSender.getWriteObject() != null); assertThat(influxDbHttpSender.getTags().isEmpty()); assertThat(influxDbHttpSender.getWriteObject().getDatabase().equals("testdb")); assertThat(influxDbHttpSender.writeData(new byte[0]) == 0); influxDbHttpSender.flush(); } catch (IOException e) { throw new IOException(e); } finally { server.stop(0); } }