### Question:
GzipCompressionOutputStream extends CompressionOutputStream { @Override public void close() throws IOException { GZIPOutputStream zos = (GZIPOutputStream) delegate; zos.close(); } GzipCompressionOutputStream( OutputStream out, ICompressionProvider provider ); @Override void close();  }### Answer:
@Test public void testClose() throws IOException { ICompressionProvider provider = outStream.getCompressionProvider(); ByteArrayOutputStream out = new ByteArrayOutputStream(); outStream = new GzipCompressionOutputStream( out, provider ) { }; outStream.close(); try { outStream.write( "This will throw an Exception if the stream is already closed".getBytes() ); fail(); } catch ( IOException e ) { } }