public void testCompression() throws Exception
{
// prepare the input data
ByteBuffer buf = ByteBuffer.wrap( strCompress.getBytes( "UTF8" ) );
ByteBuffer actualOutput = actualDeflater.deflate( buf );
WriteRequest writeRequest = new WriteRequest( 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 WriteRequest( actualOutput ) );
// switch to playback mode
mockSession.replay();
mockIoFilterChain.replay();
mockNextFilter.replay();