@Test
    public void testDoubleFlush() throws IOException {
        stream.reset();
        byte[] c = new byte[] { 97, 98, 99 };
        ByteWriter bw = new ByteWriter(stream, encoder);
        bw.append(c);
        bw.flush();
        bw.flush();
        bw.close();
        byte[] res = stream.toByteArray();
        assertTrue(Arrays.equals(new byte[] { 97, 98, 99 }, res));
    }
A stream which does nothing, but complains if it is called and asked to
do nothing.
vespajlib/src/test/java/com/yahoo/io/ByteWriterTestCase.java