public int available() {
        return buffer != null ? buffer.length - pos : 0;
    }
@Test
    public void testAvailable() {
        int available = out.available();
        out.buffer = null;
        int availableWhenBufferNull = out.available();

        assertEquals(10, available);
        assertEquals(0, availableWhenBufferNull);
    }