final void ensureAvailable(int len) {
        if (available() < len) {
            if (buffer != null) {
                int newCap = Math.max(Math.max(buffer.length << 1, buffer.length + len), firstGrowthSize);
                buffer = Arrays.copyOf(buffer, newCap);
            } else {
                buffer = new byte[len > initialSize / 2 ? len * 2 : initialSize];
            }
        }
    }
@Test
    public void testEnsureAvailable() {
        out.buffer = null;
        out.ensureAvailable(5);

        assertEquals(10, out.buffer.length);
    }