directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From trus...@apache.org
Subject svn commit: r160648 - directory/network/trunk/src/test/org/apache/mina/examples/echoserver/ConnectorTest.java
Date Sat, 09 Apr 2005 02:02:39 GMT
Author: trustin
Date: Fri Apr  8 19:02:38 2005
New Revision: 160648

URL: http://svn.apache.org/viewcvs?view=rev&rev=160648
Log:
Fixed: ConnectorTest fails if (serverPort+1) is taken.

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

Modified: directory/network/trunk/src/test/org/apache/mina/examples/echoserver/ConnectorTest.java
URL: http://svn.apache.org/viewcvs/directory/network/trunk/src/test/org/apache/mina/examples/echoserver/ConnectorTest.java?view=diff&r1=160647&r2=160648
==============================================================================
--- directory/network/trunk/src/test/org/apache/mina/examples/echoserver/ConnectorTest.java
(original)
+++ directory/network/trunk/src/test/org/apache/mina/examples/echoserver/ConnectorTest.java
Fri Apr  8 19:02:38 2005
@@ -17,6 +17,7 @@
 import org.apache.mina.io.datagram.DatagramConnector;
 import org.apache.mina.io.filter.SSLFilter;
 import org.apache.mina.io.socket.SocketConnector;
+import org.apache.mina.util.AvailablePortFinder;
 
 /**
  * Tests echo server example.
@@ -26,6 +27,14 @@
  */
 public class ConnectorTest extends AbstractTest
 {
+    private int clientPort;
+    
+    public void setUp() throws Exception
+    {
+        super.setUp();
+        clientPort = AvailablePortFinder.getNextAvailable( port + 1 );
+    }
+    
     public void testTCP() throws Exception
     {
         IoConnector connector = new SocketConnector();
@@ -37,7 +46,7 @@
     {
         IoConnector connector = new SocketConnector();
         connector.getFilterChain().addFirst( "threadPool", super.threadPoolFilter );
-        testTCP0( connector, new InetSocketAddress( port + 1 ) );
+        testTCP0( connector, new InetSocketAddress( clientPort ) );
     }
 
     /**
@@ -126,7 +135,7 @@
     {
         IoConnector connector = new DatagramConnector();
         connector.getFilterChain().addFirst( "threadPool", super.threadPoolFilter );
-        testTCP0( connector, new InetSocketAddress( port + 1 ) );
+        testTCP0( connector, new InetSocketAddress( clientPort ) );
     }
     
     private void fillWriteBuffer( ByteBuffer writeBuf, int i )



Mime
View raw message