BrotliOutputStream extends OutputStream { @Override public void close() throws IOException { brotliStreamCompressor.close(); outputStream.close(); } BrotliOutputStream(OutputStream outputStream);  BrotliOutputStream(OutputStream outputStream, Brotli.Parameter parameter); @Override void write(int i); @Override void write(byte[] buffer); @Override void write(byte[] buffer, int offset, int len); @Override void flush(); @Override void close(); int getBrotliCompressionBufferSize(); void finish();  }
@Test public void naive_test_to_make_sure_there_is_no_memory_leak_on_close_method() throws Exception { for (int i = 0; i < 65536; i++) { brotliOutputStream = new BrotliOutputStream(baos, Brotli.DEFAULT_PARAMETER.setQuality(11)); brotliOutputStream.close(); } }