public void testCompression() throws Exception {
// prepare the input data
IoBuffer buf = IoBuffer.wrap(strCompress.getBytes("UTF8"));
IoBuffer actualOutput = actualDeflater.deflate(buf);
WriteRequest writeRequest = new DefaultWriteRequest(buf);
// record all the mock calls
ioFilterChain.contains(CompressionFilter.class);
mockIoFilterChain.setReturnValue(false);
ioFilterChain.getSession();
mockIoFilterChain.setReturnValue(session);
session.setAttribute(CompressionFilter.class.getName() + ".Deflater",
deflater);
mockSession.setDefaultMatcher(new DataMatcher());
mockSession.setReturnValue(null, MockControl.ONE);
session.setAttribute(CompressionFilter.class.getName() + ".Inflater",
inflater);
mockSession.setReturnValue(null, MockControl.ONE);
session.containsAttribute(CompressionFilter.DISABLE_COMPRESSION_ONCE);
mockSession.setReturnValue(false);
session.getAttribute(CompressionFilter.class.getName() + ".Deflater");
mockSession.setReturnValue(deflater);
nextFilter.filterWrite(session, new DefaultWriteRequest(actualOutput));
// switch to playback mode
mockSession.replay();
mockIoFilterChain.replay();
mockNextFilter.replay();