directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From trus...@apache.org
Subject svn commit: r329148 - /directory/network/trunk/src/test/org/apache/mina/examples/echoserver/AbstractTest.java
Date Fri, 28 Oct 2005 07:32:04 GMT
Author: trustin
Date: Fri Oct 28 00:31:59 2005
New Revision: 329148

URL: http://svn.apache.org/viewcvs?rev=329148&view=rev
Log:
Fixing 'Address already in use' error

Modified:
    directory/network/trunk/src/test/org/apache/mina/examples/echoserver/AbstractTest.java

Modified: directory/network/trunk/src/test/org/apache/mina/examples/echoserver/AbstractTest.java
URL: http://svn.apache.org/viewcvs/directory/network/trunk/src/test/org/apache/mina/examples/echoserver/AbstractTest.java?rev=329148&r1=329147&r2=329148&view=diff
==============================================================================
--- directory/network/trunk/src/test/org/apache/mina/examples/echoserver/AbstractTest.java
(original)
+++ directory/network/trunk/src/test/org/apache/mina/examples/echoserver/AbstractTest.java
Fri Oct 28 00:31:59 2005
@@ -23,7 +23,6 @@
 import junit.framework.TestCase;
 
 import org.apache.mina.common.ByteBuffer;
-import org.apache.mina.common.IoAcceptor;
 import org.apache.mina.common.IoSession;
 import org.apache.mina.common.TransportType;
 import org.apache.mina.filter.LoggingFilter;
@@ -31,6 +30,7 @@
 import org.apache.mina.registry.Service;
 import org.apache.mina.registry.ServiceRegistry;
 import org.apache.mina.registry.SimpleServiceRegistry;
+import org.apache.mina.transport.socket.nio.SocketAcceptor;
 import org.apache.mina.util.SessionLog;
 
 /**
@@ -83,6 +83,9 @@
         boolean socketBound = false;
         boolean datagramBound = false;
 
+        final SocketAcceptor acceptor = ( SocketAcceptor ) registry.getAcceptor( TransportType.SOCKET
);
+        acceptor.setReuseAddress( true );
+
         // Let's start from port #1 to detect possible resource leak
         // because test will fail in port 1-1023 if user run this test
         // as a normal user.
@@ -96,7 +99,6 @@
             
             try
             {
-                final IoAcceptor acceptor = registry.getAcceptor( TransportType.SOCKET );
                 registry.bind( socketService, new EchoProtocolHandler()
                 {
                     // This is for TLS reentrance test



Mime
View raw message