CacheableHttpServletResponse extends HttpServletResponseWrapper { @Override public ServletOutputStream getOutputStream() throws IOException { if (out != null) throw new IllegalStateException("A writer has already been allocated"); osCalled = true; return tx != null ? tx.getOutputStream() : super.getOutputStream(); } CacheableHttpServletResponse(HttpServletResponse response); CacheTransaction startTransaction(CacheHandle handle,
      StreamFilter filter); @Override PrintWriter getWriter(); @Override ServletOutputStream getOutputStream(); boolean isValid(); CacheTransaction getTransaction(); @Override void setContentType(String type); @Override void flushBuffer(); @Override void addHeader(String name, String value); @Override void setHeader(String name, String value); @Override void addDateHeader(String name, long date); @Override void addIntHeader(String name, int value); @Override void setDateHeader(String name, long date); @Override void setIntHeader(String name, int value);  }
@Test public void testGetOutputStream() throws Exception { assertNotNull(response.getOutputStream()); try { response.getWriter(); fail(); } catch (IllegalStateException e) { } }