Randomize port to allow concurrent execution 61/1861/1
authorRobert Varga <rovarga@cisco.com>
Sun, 13 Oct 2013 19:53:48 +0000 (21:53 +0200)
committerRobert Varga <rovarga@cisco.com>
Sun, 13 Oct 2013 19:53:48 +0000 (21:53 +0200)
Change-Id: I6ace15cc81e710ef96a36c24613fc904b88d1b2b
Signed-off-by: Robert Varga <rovarga@cisco.com>
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 {