@Test
public void testClose() throws Exception {

    final ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
    final SessionOutputBuffer outbuffer = new SessionOutputBufferImpl(16);
    final OutputStream out = new ContentLengthOutputStream(outbuffer, outputStream, 15L);
    out.close();
    out.close();
    final byte[] tmp = new byte[10];
    try {
        out.write(tmp);
        Assert.fail("StreamClosedException expected");
    } catch (final StreamClosedException expected) {
    }
    try {
        out.write(1);
        Assert.fail("StreamClosedException expected");
    } catch (final StreamClosedException expected) {
    }
}