@Test
  public void testResetBuffer() throws IOException {
    when(response.isCommitted()).thenReturn(false);
    ServletOutputStream out = mock(ServletOutputStream.class);
    when(response.getOutputStream()).thenReturn(out);

    ServletOutputStream servletOutput = wrapper.getOutputStream();
    assertEquals(GZIPResponseStream.class, servletOutput.getClass());
    wrapper.resetBuffer();
    verify(response).setHeader("Content-Encoding", null);

    when(response.isCommitted()).thenReturn(true);
    servletOutput = wrapper.getOutputStream();
    assertEquals(out.getClass(), servletOutput.getClass());
    assertNotNull(wrapper.getWriter());
  }
wrapper should set all headers except "content-length"
hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/TestGZIPResponseWrapper.java