static InputStream createDummyInputStream(int payloadSize) {
        Instant end = Instant.now().plusSeconds(60);
        return createDummyInputStream(payloadSize, ThreadLocalRandom.current(), () -> Instant.now().isBefore(end));
    }
@Test
    void testDummyStream() throws IOException {
        AtomicInteger count = new AtomicInteger(3);
        InputStream in = CliClient.createDummyInputStream(4, new Random(0), () -> count.decrementAndGet() >= 0);
        byte[] buffer = new byte[1 << 20];
        int offset = 0, read;
        while ((read = in.read(buffer, offset, buffer.length - offset)) >= 0) offset += read;
        assertEquals("{ \"put\": \"id:test:test::ssxvnjhp\", \"fields\": { \"test\": \"dqdx\" } }\n" +
                     "{ \"put\": \"id:test:test::vcrastvy\", \"fields\": { \"test\": \"bcwv\" } }\n" +
                     "{ \"put\": \"id:test:test::mgnykrxv\", \"fields\": { \"test\": \"zxkg\" } }\n",
                     new String(buffer, 0, offset, StandardCharsets.UTF_8));
    }