Merge "Randomize port to allow concurrent execution"
authorDana Kutenicsova <dkutenic@cisco.com>
Mon, 14 Oct 2013 06:56:03 +0000 (06:56 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Mon, 14 Oct 2013 06:56:03 +0000 (06:56 +0000)
framework/src/test/java/org/opendaylight/protocol/framework/ServerTest.java

index e605c135761a52386e3733f7f656502ef6bf829c..de214877f68be5ef26be712a61d1379534a5e25e 100644 (file)
@@ -23,11 +23,10 @@ import java.util.concurrent.TimeUnit;
 import java.util.concurrent.TimeoutException;
 
 import org.junit.After;
+import org.junit.Before;
 import org.junit.Test;
 
 public class ServerTest {
-       public static final int PORT = 18080;
-
        SimpleDispatcher clientDispatcher, dispatcher;
 
        final SimpleSessionListener pce = new SimpleSessionListener();
@@ -36,7 +35,13 @@ public class ServerTest {
 
        ChannelFuture server = null;
 
-       public final InetSocketAddress serverAddress = new InetSocketAddress("127.0.0.5", PORT);
+       InetSocketAddress serverAddress;
+
+       @Before
+       public void setUp() {
+               final int port = 10000 + (int)(10000 * Math.random());
+               serverAddress = new InetSocketAddress("127.0.0.5", port);
+       }
 
        @Test
        public void testConnectionEstablished() throws Exception {