@Test
public void testClose() throws Exception {

    final ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
    final SessionOutputBuffer outbuffer = new SessionOutputBufferImpl(16);
    final OutputStream out = new IdentityOutputStream(outbuffer, outputStream);
    out.close();
    out.close();
    final byte[] tmp = new byte[10];
    try {
        out.write(tmp);
        Assert.fail("IOException should have been thrown");
    } catch (final IOException ex) {
        // expected
    }
    try {
        out.write(1);
        Assert.fail("IOException should have been thrown");
    } catch (final IOException ex) {
        // expected
    }
}