You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by tr...@apache.org on 2005/12/01 06:19:07 UTC

svn commit: r350169 [16/16] - in /directory/network: branches/chain_refactor/src/java/org/apache/mina/common/ trunk/src/examples/org/apache/mina/examples/echoserver/ trunk/src/examples/org/apache/mina/examples/httpserver/ trunk/src/examples/org/apache/...

Modified: directory/network/trunk/src/test/org/apache/mina/filter/codec/CumulativeProtocolDecoderTest.java
URL: http://svn.apache.org/viewcvs/directory/network/trunk/src/test/org/apache/mina/filter/codec/CumulativeProtocolDecoderTest.java?rev=350169&r1=350168&r2=350169&view=diff
==============================================================================
--- directory/network/trunk/src/test/org/apache/mina/filter/codec/CumulativeProtocolDecoderTest.java (original)
+++ directory/network/trunk/src/test/org/apache/mina/filter/codec/CumulativeProtocolDecoderTest.java Wed Nov 30 21:17:41 2005
@@ -1,239 +1,245 @@
-/*
- *   @(#) $Id$
- *
- *   Copyright 2004 The Apache Software Foundation
- *
- *   Licensed under the Apache License, Version 2.0 (the "License");
- *   you may not use this file except in compliance with the License.
- *   You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *   Unless required by applicable law or agreed to in writing, software
- *   distributed under the License is distributed on an "AS IS" BASIS,
- *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *   See the License for the specific language governing permissions and
- *   limitations under the License.
- *
- */
-package org.apache.mina.filter.codec;
-
-import java.net.SocketAddress;
-import java.util.ArrayList;
-import java.util.List;
-
-import junit.framework.Assert;
-import junit.framework.TestCase;
-
-import org.apache.mina.common.ByteBuffer;
-import org.apache.mina.common.CloseFuture;
-import org.apache.mina.common.IoFilterChain;
-import org.apache.mina.common.IoHandler;
-import org.apache.mina.common.IoSession;
-import org.apache.mina.common.TransportType;
-import org.apache.mina.common.WriteFuture;
-import org.apache.mina.common.support.BaseIoSession;
-
-/**
- * Tests {@link CumulativeProtocolDecoder}.
- * 
- * @author The Apache Directory Project (dev@directory.apache.org)
- * @version $Rev$, $Date$ 
- */
-public class CumulativeProtocolDecoderTest extends TestCase
-{
-    private final IoSession session = new IoSessionImpl();
-    private ByteBuffer buf;
-    private IntegerDecoder decoder;
-    private IntegerDecoderOutput output;
-
-    public static void main(String[] args)
-    {
-        junit.textui.TestRunner.run(CumulativeProtocolDecoderTest.class);
-    }
-
-    protected void setUp() throws Exception
-    {
-        buf = ByteBuffer.allocate( 16 );
-        decoder = new IntegerDecoder();
-        output = new IntegerDecoderOutput();
-    }
-
-    protected void tearDown() throws Exception
-    {
-        decoder.dispose( session );
-    }
-    
-    public void testCumulation() throws Exception
-    {
-        buf.put( (byte) 0 );
-        buf.flip();
-        
-        decoder.decode( session, buf, output );
-        Assert.assertEquals( 0, output.getValues().size() );
-        Assert.assertEquals( buf.limit(), buf.position() );
-        
-        buf.clear();
-        buf.put( (byte) 0 );
-        buf.put( (byte) 0 );
-        buf.put( (byte) 1 );
-        buf.flip();
-
-        decoder.decode( session, buf, output );
-        Assert.assertEquals( 1, output.getValues().size() );
-        Assert.assertEquals( new Integer( 1 ), output.getValues().get( 0 ) );
-        Assert.assertEquals( buf.limit(), buf.position() );
-    }
-    
-    public void testRepeatitiveDecode() throws Exception
-    {
-        for( int i = 0; i < 4; i ++ )
-        {
-            buf.putInt( i );
-        }
-        buf.flip();
-        
-        decoder.decode( session, buf, output );
-        Assert.assertEquals( 4, output.getValues().size() );
-        Assert.assertEquals( buf.limit(), buf.position() );
-        
-        List expected = new ArrayList();
-        for( int i = 0; i < 4; i ++ )
-        {
-            expected.add( new Integer( i ) );
-        }
-        Assert.assertEquals( expected, output.getValues() );
-    }
-    
-    public void testWrongImplementationDetection() throws Exception {
-        try
-        {
-            new WrongDecoder().decode( session, buf, output );
-            Assert.fail();
-        }
-        catch( IllegalStateException e )
-        {
-            // OK
-        }
-    }
-    
-    private static class IntegerDecoder extends CumulativeProtocolDecoder
-    {
-        protected IntegerDecoder()
-        {
-            super( 4 );
-        }
-
-        protected boolean doDecode( IoSession session, ByteBuffer in,
-                                    ProtocolDecoderOutput out ) throws Exception
-        {
-            Assert.assertTrue( in.hasRemaining() );
-            if( in.remaining() < 4 )
-                return false;
-            
-            out.write( new Integer( in.getInt() ) );
-            return true;
-        }
-
-        public void dispose() throws Exception
-        {
-        }
-        
-    }
-    
-    private static class IntegerDecoderOutput implements ProtocolDecoderOutput
-    {
-        private List values = new ArrayList();
-
-        public void write( Object message )
-        {
-            values.add( message );
-        }
-        
-        public List getValues()
-        {
-            return values;
-        }
-        
-        public void clear()
-        {
-            values.clear();
-        }
-    }
-    
-    private static class WrongDecoder extends CumulativeProtocolDecoder
-    {
-        public WrongDecoder()
-        {
-            super( 4 );
-        }
-
-        protected boolean doDecode( IoSession session, ByteBuffer in,
-                                    ProtocolDecoderOutput out ) throws Exception {
-            return true;
-        }
-
-        public void dispose() throws Exception
-        {
-        }
-    }
-    
-    private static class IoSessionImpl extends BaseIoSession implements IoSession
-    {
-
-        public IoHandler getHandler() {
-            return null;
-        }
-
-        public ProtocolEncoder getEncoder() {
-            return null;
-        }
-
-        public ProtocolDecoder getDecoder() {
-            return null;
-        }
-
-        public CloseFuture close() {
-            return null;
-        }
-
-        public WriteFuture write( Object message ) {
-            return null;
-        }
-
-        public TransportType getTransportType() {
-            return TransportType.SOCKET;
-        }
-
-        public boolean isConnected() {
-            return false;
-        }
-
-        public SocketAddress getRemoteAddress() {
-            return null;
-        }
-
-        public SocketAddress getLocalAddress() {
-            return null;
-        }
-
-        public IoFilterChain getFilterChain()
-        {
-            return null;
-        }
-
-        public int getScheduledWriteRequests()
-        {
-            return 0;
-        }
-
-        protected void updateTrafficMask()
-        {
-        }
-
-        public boolean isClosing()
-        {
-            return false;
-        }
-    }
-}
+/*
+ *   @(#) $Id$
+ *
+ *   Copyright 2004 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+package org.apache.mina.filter.codec;
+
+import java.net.SocketAddress;
+import java.util.ArrayList;
+import java.util.List;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.apache.mina.common.ByteBuffer;
+import org.apache.mina.common.CloseFuture;
+import org.apache.mina.common.IoFilterChain;
+import org.apache.mina.common.IoHandler;
+import org.apache.mina.common.IoSession;
+import org.apache.mina.common.IoSessionManager;
+import org.apache.mina.common.TransportType;
+import org.apache.mina.common.WriteFuture;
+import org.apache.mina.common.support.BaseIoSession;
+
+/**
+ * Tests {@link CumulativeProtocolDecoder}.
+ * 
+ * @author The Apache Directory Project (dev@directory.apache.org)
+ * @version $Rev$, $Date$ 
+ */
+public class CumulativeProtocolDecoderTest extends TestCase
+{
+    private final IoSession session = new IoSessionImpl();
+    private ByteBuffer buf;
+    private IntegerDecoder decoder;
+    private IntegerDecoderOutput output;
+
+    public static void main(String[] args)
+    {
+        junit.textui.TestRunner.run(CumulativeProtocolDecoderTest.class);
+    }
+
+    protected void setUp() throws Exception
+    {
+        buf = ByteBuffer.allocate( 16 );
+        decoder = new IntegerDecoder();
+        output = new IntegerDecoderOutput();
+    }
+
+    protected void tearDown() throws Exception
+    {
+        decoder.dispose( session );
+    }
+    
+    public void testCumulation() throws Exception
+    {
+        buf.put( (byte) 0 );
+        buf.flip();
+        
+        decoder.decode( session, buf, output );
+        Assert.assertEquals( 0, output.getValues().size() );
+        Assert.assertEquals( buf.limit(), buf.position() );
+        
+        buf.clear();
+        buf.put( (byte) 0 );
+        buf.put( (byte) 0 );
+        buf.put( (byte) 1 );
+        buf.flip();
+
+        decoder.decode( session, buf, output );
+        Assert.assertEquals( 1, output.getValues().size() );
+        Assert.assertEquals( new Integer( 1 ), output.getValues().get( 0 ) );
+        Assert.assertEquals( buf.limit(), buf.position() );
+    }
+    
+    public void testRepeatitiveDecode() throws Exception
+    {
+        for( int i = 0; i < 4; i ++ )
+        {
+            buf.putInt( i );
+        }
+        buf.flip();
+        
+        decoder.decode( session, buf, output );
+        Assert.assertEquals( 4, output.getValues().size() );
+        Assert.assertEquals( buf.limit(), buf.position() );
+        
+        List expected = new ArrayList();
+        for( int i = 0; i < 4; i ++ )
+        {
+            expected.add( new Integer( i ) );
+        }
+        Assert.assertEquals( expected, output.getValues() );
+    }
+    
+    public void testWrongImplementationDetection() throws Exception {
+        try
+        {
+            new WrongDecoder().decode( session, buf, output );
+            Assert.fail();
+        }
+        catch( IllegalStateException e )
+        {
+            // OK
+        }
+    }
+    
+    private static class IntegerDecoder extends CumulativeProtocolDecoder
+    {
+        protected IntegerDecoder()
+        {
+            super( 4 );
+        }
+
+        protected boolean doDecode( IoSession session, ByteBuffer in,
+                                    ProtocolDecoderOutput out ) throws Exception
+        {
+            Assert.assertTrue( in.hasRemaining() );
+            if( in.remaining() < 4 )
+                return false;
+            
+            out.write( new Integer( in.getInt() ) );
+            return true;
+        }
+
+        public void dispose() throws Exception
+        {
+        }
+        
+    }
+    
+    private static class IntegerDecoderOutput implements ProtocolDecoderOutput
+    {
+        private List values = new ArrayList();
+
+        public void write( Object message )
+        {
+            values.add( message );
+        }
+        
+        public List getValues()
+        {
+            return values;
+        }
+        
+        public void clear()
+        {
+            values.clear();
+        }
+    }
+    
+    private static class WrongDecoder extends CumulativeProtocolDecoder
+    {
+        public WrongDecoder()
+        {
+            super( 4 );
+        }
+
+        protected boolean doDecode( IoSession session, ByteBuffer in,
+                                    ProtocolDecoderOutput out ) throws Exception {
+            return true;
+        }
+
+        public void dispose() throws Exception
+        {
+        }
+    }
+    
+    private static class IoSessionImpl extends BaseIoSession implements IoSession
+    {
+
+        public IoHandler getHandler() {
+            return null;
+        }
+
+        public ProtocolEncoder getEncoder() {
+            return null;
+        }
+
+        public ProtocolDecoder getDecoder() {
+            return null;
+        }
+
+        public CloseFuture close() {
+            return null;
+        }
+
+        public WriteFuture write( Object message ) {
+            return null;
+        }
+
+        public TransportType getTransportType() {
+            return TransportType.SOCKET;
+        }
+
+        public boolean isConnected() {
+            return false;
+        }
+
+        public SocketAddress getRemoteAddress() {
+            return null;
+        }
+
+        public SocketAddress getLocalAddress() {
+            return null;
+        }
+
+        public IoFilterChain getFilterChain()
+        {
+            return null;
+        }
+
+        public int getScheduledWriteRequests()
+        {
+            return 0;
+        }
+
+        protected void updateTrafficMask()
+        {
+        }
+
+        public boolean isClosing()
+        {
+            return false;
+        }
+
+        public IoSessionManager getManager()
+        {
+            return null;
+        }
+    }
+}

Modified: directory/network/trunk/src/test/org/apache/mina/integration/spring/support/AbstractIoSessionManagerFactoryBeanTest.java
URL: http://svn.apache.org/viewcvs/directory/network/trunk/src/test/org/apache/mina/integration/spring/support/AbstractIoSessionManagerFactoryBeanTest.java?rev=350169&r1=350168&r2=350169&view=diff
==============================================================================
--- directory/network/trunk/src/test/org/apache/mina/integration/spring/support/AbstractIoSessionManagerFactoryBeanTest.java (original)
+++ directory/network/trunk/src/test/org/apache/mina/integration/spring/support/AbstractIoSessionManagerFactoryBeanTest.java Wed Nov 30 21:17:41 2005
@@ -20,12 +20,13 @@
 
 import junit.framework.TestCase;
 
+import org.apache.mina.common.DefaultIoFilterChainBuilder;
 import org.apache.mina.common.ExceptionMonitor;
 import org.apache.mina.common.IoFilter;
-import org.apache.mina.common.IoFilterChain;
 import org.apache.mina.common.IoSessionManager;
 import org.apache.mina.integration.spring.IoFilterMapping;
 import org.easymock.MockControl;
+import org.easymock.classextension.MockClassControl;
 
 /**
  * Tests
@@ -70,8 +71,8 @@
         /*
          * Create EasyMock mocks.
          */
-        MockControl mockIoFilterChain = MockControl
-                .createStrictControl( IoFilterChain.class );
+        MockControl mockIoFilterChainBuilder = MockClassControl
+                .createStrictControl( DefaultIoFilterChainBuilder.class );
         MockControl mockIoSessionManager = MockControl
                 .createControl( IoSessionManager.class );
 
@@ -85,23 +86,23 @@
 
         IoSessionManager ioSessionManager = ( IoSessionManager ) mockIoSessionManager
                 .getMock();
-        IoFilterChain ioFilterChain = ( IoFilterChain ) mockIoFilterChain
+        DefaultIoFilterChainBuilder ioFilterChainBuilder = ( DefaultIoFilterChainBuilder ) mockIoFilterChainBuilder
                 .getMock();
 
         /*
          * Record expectations.
          */
-        ioFilterChain.addLast( "filter0", filters[ 0 ] );
-        ioFilterChain.addLast( "filter1", filters[ 1 ] );
-        ioFilterChain.addLast( "filter2", filters[ 2 ] );
+        ioFilterChainBuilder.addLast( "filter0", filters[ 0 ] );
+        ioFilterChainBuilder.addLast( "filter1", filters[ 1 ] );
+        ioFilterChainBuilder.addLast( "filter2", filters[ 2 ] );
 
         ioSessionManager.getFilterChain();
-        mockIoSessionManager.setReturnValue( mockIoFilterChain.getMock() );
+        mockIoSessionManager.setReturnValue( mockIoFilterChainBuilder.getMock() );
 
         /*
          * Replay.
          */
-        mockIoFilterChain.replay();
+        mockIoFilterChainBuilder.replay();
         mockIoSessionManager.replay();
 
         factory.setFilters( filters );
@@ -110,7 +111,7 @@
         /*
          * Verify.
          */
-        mockIoFilterChain.verify();
+        mockIoFilterChainBuilder.verify();
         mockIoSessionManager.verify();
     }
 
@@ -125,8 +126,8 @@
         /*
          * Create EasyMock mocks.
          */
-        MockControl mockIoFilterChain = MockControl
-                .createStrictControl( IoFilterChain.class );
+        MockControl mockIoFilterChainBuilder = MockClassControl
+                .createStrictControl( DefaultIoFilterChainBuilder.class );
         MockControl mockIoSessionManager = MockControl
                 .createControl( IoSessionManager.class );
 
@@ -140,23 +141,23 @@
 
         IoSessionManager ioSessionManager = ( IoSessionManager ) mockIoSessionManager
                 .getMock();
-        IoFilterChain ioFilterChain = ( IoFilterChain ) mockIoFilterChain
+        DefaultIoFilterChainBuilder ioFilterChainBuilder = ( DefaultIoFilterChainBuilder ) mockIoFilterChainBuilder
                 .getMock();
 
         /*
          * Record expectations.
          */
-        ioFilterChain.addLast( "first", mappings[ 0 ].getFilter() );
-        ioFilterChain.addLast( "second", mappings[ 1 ].getFilter() );
-        ioFilterChain.addLast( "third", mappings[ 2 ].getFilter() );
+        ioFilterChainBuilder.addLast( "first", mappings[ 0 ].getFilter() );
+        ioFilterChainBuilder.addLast( "second", mappings[ 1 ].getFilter() );
+        ioFilterChainBuilder.addLast( "third", mappings[ 2 ].getFilter() );
 
         ioSessionManager.getFilterChain();
-        mockIoSessionManager.setReturnValue( mockIoFilterChain.getMock() );
+        mockIoSessionManager.setReturnValue( mockIoFilterChainBuilder.getMock() );
 
         /*
          * Replay.
          */
-        mockIoFilterChain.replay();
+        mockIoFilterChainBuilder.replay();
         mockIoSessionManager.replay();
 
         factory.setFilterMappings( mappings );
@@ -165,7 +166,7 @@
         /*
          * Verify.
          */
-        mockIoFilterChain.verify();
+        mockIoFilterChainBuilder.verify();
         mockIoSessionManager.verify();
     }
 
@@ -184,8 +185,8 @@
 
         IoSessionManager ioSessionManager = ( IoSessionManager ) mockIoSessionManager
                 .getMock();
-        IoFilterChain ioFilterChain = ( IoFilterChain ) MockControl
-                .createControl( IoFilterChain.class ).getMock();
+        DefaultIoFilterChainBuilder ioFilterChainBuilder = ( DefaultIoFilterChainBuilder ) MockClassControl
+                .createControl( DefaultIoFilterChainBuilder.class ).getMock();
         ExceptionMonitor exceptionMonitor = ( ExceptionMonitor ) MockControl
                 .createControl( ExceptionMonitor.class ).getMock();
 
@@ -193,7 +194,7 @@
          * Record expectations.
          */
         ioSessionManager.getFilterChain();
-        mockIoSessionManager.setReturnValue( ioFilterChain );
+        mockIoSessionManager.setReturnValue( ioFilterChainBuilder );
         ioSessionManager.setExceptionMonitor( exceptionMonitor );
 
         /*
@@ -220,27 +221,27 @@
         /*
          * Create EasyMock mocks.
          */
-        MockControl mockIoFilterChain = MockControl
-                .createStrictControl( IoFilterChain.class );
+        MockControl mockIoFilterChainBuilder = MockClassControl
+                .createStrictControl( DefaultIoFilterChainBuilder.class );
         MockControl mockIoSessionManager = MockControl
                 .createControl( IoSessionManager.class );
 
         IoSessionManager ioSessionManager = ( IoSessionManager ) mockIoSessionManager
                 .getMock();
-        IoFilterChain ioFilterChain = ( IoFilterChain ) mockIoFilterChain
+        DefaultIoFilterChainBuilder ioFilterChainBuilder = ( DefaultIoFilterChainBuilder ) mockIoFilterChainBuilder
                 .getMock();
 
         /*
          * Record expectations.
          */
         ioSessionManager.getFilterChain();
-        mockIoSessionManager.setReturnValue( ioFilterChain );
-        ioFilterChain.clear();
+        mockIoSessionManager.setReturnValue( ioFilterChainBuilder );
+        ioFilterChainBuilder.clear();
 
         /*
          * Replay.
          */
-        mockIoFilterChain.replay();
+        mockIoFilterChainBuilder.replay();
         mockIoSessionManager.replay();
 
         factory.destroyIoSessionManager( ioSessionManager );
@@ -248,7 +249,7 @@
         /*
          * Verify.
          */
-        mockIoFilterChain.verify();
+        mockIoFilterChainBuilder.verify();
         mockIoSessionManager.verify();
     }
 

Modified: directory/network/trunk/src/test/org/apache/mina/transport/socket/nio/AbstractBindTest.java
URL: http://svn.apache.org/viewcvs/directory/network/trunk/src/test/org/apache/mina/transport/socket/nio/AbstractBindTest.java?rev=350169&r1=350168&r2=350169&view=diff
==============================================================================
--- directory/network/trunk/src/test/org/apache/mina/transport/socket/nio/AbstractBindTest.java (original)
+++ directory/network/trunk/src/test/org/apache/mina/transport/socket/nio/AbstractBindTest.java Wed Nov 30 21:17:41 2005
@@ -34,7 +34,7 @@
  * @author The Apache Directory Project (dev@directory.apache.org)
  * @version $Rev$, $Date$ 
  */
-public class AbstractBindTest extends TestCase
+public abstract class AbstractBindTest extends TestCase
 {
     protected final IoAcceptor acceptor;
     protected int port;

Modified: directory/network/trunk/src/test/org/apache/mina/util/IoFilterImpl.java
URL: http://svn.apache.org/viewcvs/directory/network/trunk/src/test/org/apache/mina/util/IoFilterImpl.java?rev=350169&r1=350168&r2=350169&view=diff
==============================================================================
--- directory/network/trunk/src/test/org/apache/mina/util/IoFilterImpl.java (original)
+++ directory/network/trunk/src/test/org/apache/mina/util/IoFilterImpl.java Wed Nov 30 21:17:41 2005
@@ -1,59 +1,59 @@
-/*
- *   @(#) $Id$
- *
- *   Copyright 2004 The Apache Software Foundation
- *
- *   Licensed under the Apache License, Version 2.0 (the "License");
- *   you may not use this file except in compliance with the License.
- *   You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *   Unless required by applicable law or agreed to in writing, software
- *   distributed under the License is distributed on an "AS IS" BASIS,
- *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *   See the License for the specific language governing permissions and
- *   limitations under the License.
- *
- */
-package org.apache.mina.util;
-
-import org.apache.mina.common.IoFilter;
-import org.apache.mina.common.IoFilterAdapter;
-import org.apache.mina.common.IoFilterChain;
-
-/**
- * Bogus implementation of {@link IoFilter} to test
- * {@link IoFilterChain}.
- * 
- * @author The Apache Directory Project (dev@directory.apache.org)
- * @version $Rev$, $Date$
- */
-public class IoFilterImpl extends IoFilterAdapter
-{
-    private final char c;
-
-    public IoFilterImpl( char c )
-    {
-        this.c = c;
-    }
-
-    public int hashCode()
-    {
-        return c;
-    }
-
-    public boolean equals( Object o )
-    {
-        if( o == null )
-            return false;
-        if( ! ( o instanceof IoFilterImpl ) )
-            return false;
-        return this.c == ( ( IoFilterImpl ) o ).c;
-    }
-
-    public String toString()
-    {
-        return "" + c;
-    }
+/*
+ *   @(#) $Id$
+ *
+ *   Copyright 2004 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+package org.apache.mina.util;
+
+import org.apache.mina.common.IoFilter;
+import org.apache.mina.common.IoFilterAdapter;
+import org.apache.mina.common.IoFilterChain;
+
+/**
+ * Bogus implementation of {@link IoFilter} to test
+ * {@link IoFilterChain}.
+ * 
+ * @author The Apache Directory Project (dev@directory.apache.org)
+ * @version $Rev$, $Date$
+ */
+public class IoFilterImpl extends IoFilterAdapter
+{
+    private final char c;
+
+    public IoFilterImpl( char c )
+    {
+        this.c = c;
+    }
+
+    public int hashCode()
+    {
+        return c;
+    }
+
+    public boolean equals( Object o )
+    {
+        if( o == null )
+            return false;
+        if( ! ( o instanceof IoFilterImpl ) )
+            return false;
+        return this.c == ( ( IoFilterImpl ) o ).c;
+    }
+
+    public String toString()
+    {
+        return "" + c;
+    }
 }