mina-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From trus...@apache.org
Subject svn commit: r655867 - /mina/trunk/example/src/test/java/org/apache/mina/example/echoserver/ssl/SslFilterTest.java
Date Tue, 13 May 2008 13:57:48 GMT
Author: trustin
Date: Tue May 13 06:57:47 2008
New Revision: 655867

URL: http://svn.apache.org/viewvc?rev=655867&view=rev
Log:
Fixed another failing test

Modified:
    mina/trunk/example/src/test/java/org/apache/mina/example/echoserver/ssl/SslFilterTest.java

Modified: mina/trunk/example/src/test/java/org/apache/mina/example/echoserver/ssl/SslFilterTest.java
URL: http://svn.apache.org/viewvc/mina/trunk/example/src/test/java/org/apache/mina/example/echoserver/ssl/SslFilterTest.java?rev=655867&r1=655866&r2=655867&view=diff
==============================================================================
--- mina/trunk/example/src/test/java/org/apache/mina/example/echoserver/ssl/SslFilterTest.java
(original)
+++ mina/trunk/example/src/test/java/org/apache/mina/example/echoserver/ssl/SslFilterTest.java
Tue May 13 06:57:47 2008
@@ -14,19 +14,18 @@
 
 import junit.framework.TestCase;
 
-import org.apache.mina.common.IoAcceptor;
 import org.apache.mina.common.IoHandlerAdapter;
 import org.apache.mina.common.IoSession;
 import org.apache.mina.filter.codec.ProtocolCodecFilter;
 import org.apache.mina.filter.codec.textline.TextLineCodecFactory;
 import org.apache.mina.filter.ssl.SslFilter;
+import org.apache.mina.transport.socket.SocketAcceptor;
 import org.apache.mina.transport.socket.nio.NioSocketAcceptor;
 
 public class SslFilterTest extends TestCase {
 
-    private static final int PORT = 17887;
-
-    private IoAcceptor acceptor;
+    private int port;
+    private SocketAcceptor acceptor;
 
     @Override
     protected void setUp() throws Exception {
@@ -62,7 +61,8 @@
 
         EchoHandler handler = new EchoHandler();
         acceptor.setHandler(handler);
-        acceptor.bind(new InetSocketAddress(PORT));
+        acceptor.bind(new InetSocketAddress(0));
+        port = acceptor.getLocalAddress().getPort();
         System.out.println("MINA server started.");
 
         Socket socket = getClientSocket(useSSL);
@@ -112,9 +112,9 @@
         if (ssl) {
             SSLContext ctx = SSLContext.getInstance("TLS");
             ctx.init(null, trustManagers, null);
-            return ctx.getSocketFactory().createSocket("localhost", PORT);
+            return ctx.getSocketFactory().createSocket("localhost", port);
         }
-        return new Socket("localhost", PORT);
+        return new Socket("localhost", port);
     }
 
     private static class EchoHandler extends IoHandlerAdapter {



Mime
View raw message