BrotliServletOutputStream extends ServletOutputStream { @Override public void close() throws IOException { brotliOutputStream.close(); } BrotliServletOutputStream(OutputStream outputStream);  BrotliServletOutputStream(OutputStream outputStream, Brotli.Parameter parameter); int getBrotliCompressionBufferSize(); @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(); @Override boolean isReady(); @Override void setWriteListener(WriteListener writeListener);  }
@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 BrotliServletOutputStream(baos, Brotli.DEFAULT_PARAMETER.setQuality(11)); brotliOutputStream.close(); } }