directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r359266 - in /directory/trunk: org.apache.mina.ssl/src/main/java/org/apache/mina/filter/ org.apache.mina/src/main/java/org/apache/mina/filter/ org.apache.mina/src/test/java/org/apache/mina/transport/socket/nio/
Date Tue, 27 Dec 2005 19:41:34 GMT
Author: akarasulu
Date: Tue Dec 27 11:41:28 2005
New Revision: 359266

URL: http://svn.apache.org/viewcvs?rev=359266&view=rev
Log:
got org.apache.mina compiling in eclipse without m2 build working

Added:
    directory/trunk/org.apache.mina.ssl/src/main/java/org/apache/mina/filter/SSLFilter.java
      - copied unchanged from r359263, directory/trunk/org.apache.mina/src/main/java/org/apache/mina/filter/SSLFilter.java
Removed:
    directory/trunk/org.apache.mina/src/main/java/org/apache/mina/filter/SSLFilter.java
Modified:
    directory/trunk/org.apache.mina/src/test/java/org/apache/mina/transport/socket/nio/AbstractBindTest.java

Modified: directory/trunk/org.apache.mina/src/test/java/org/apache/mina/transport/socket/nio/AbstractBindTest.java
URL: http://svn.apache.org/viewcvs/directory/trunk/org.apache.mina/src/test/java/org/apache/mina/transport/socket/nio/AbstractBindTest.java?rev=359266&r1=359265&r2=359266&view=diff
==============================================================================
--- directory/trunk/org.apache.mina/src/test/java/org/apache/mina/transport/socket/nio/AbstractBindTest.java
(original)
+++ directory/trunk/org.apache.mina/src/test/java/org/apache/mina/transport/socket/nio/AbstractBindTest.java
Tue Dec 27 11:41:28 2005
@@ -25,8 +25,14 @@
 import junit.framework.Assert;
 import junit.framework.TestCase;
 
+import org.apache.mina.common.ByteBuffer;
+import org.apache.mina.common.IdleStatus;
 import org.apache.mina.common.IoAcceptor;
-import org.apache.mina.examples.echoserver.EchoProtocolHandler;
+import org.apache.mina.common.IoHandlerAdapter;
+import org.apache.mina.common.IoSession;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 
 /**
  * Tests {@link IoAcceptor} resource leakage by repeating bind and unbind.
@@ -146,4 +152,45 @@
         setUp();
     }
 
+    
+    class EchoProtocolHandler extends IoHandlerAdapter
+    {
+        private final Logger log = LoggerFactory.getLogger( EchoProtocolHandler.class );
+
+        public void sessionCreated( IoSession session )
+        {
+            if( session instanceof SocketSession )
+            {
+                ( ( SocketSession ) session ).setSessionReceiveBufferSize( 2048 );
+            }
+
+            session.setIdleTime( IdleStatus.BOTH_IDLE, 10 );
+        }
+
+        public void sessionIdle( IoSession session, IdleStatus status )
+        {
+            log.info( "*** IDLE #" + session.getIdleCount( IdleStatus.BOTH_IDLE ) + " ***"
);
+        }
+
+        public void exceptionCaught( IoSession session, Throwable cause )
+        {
+            cause.printStackTrace();
+            session.close();
+        }
+
+        public void messageReceived( IoSession session, Object message ) throws Exception
+        {
+            if( !( message instanceof ByteBuffer ) )
+            {
+                return;
+            }
+
+            ByteBuffer rb = ( ByteBuffer ) message;
+            // Write the received data back to remote peer
+            ByteBuffer wb = ByteBuffer.allocate( rb.remaining() );
+            wb.put( rb );
+            wb.flip();
+            session.write( wb );
+        }
+    }
 }



Mime
View raw message