jdk/test/java/nio/channels/Selector/ByteServer.java
changeset 5798 9cc262cd2a7a
parent 5506 202f599c92aa
child 7668 d4a77089c587
--- a/jdk/test/java/nio/channels/Selector/ByteServer.java	Tue Jun 15 20:34:49 2010 -0700
+++ b/jdk/test/java/nio/channels/Selector/ByteServer.java	Wed Jun 16 14:24:46 2010 +0100
@@ -33,7 +33,6 @@
 
 public class ByteServer {
 
-    public static final int PORT = 31415;
     public static final String LOCALHOST = "localhost";
     private int bytecount;
     private Socket  socket;
@@ -43,7 +42,11 @@
 
     public ByteServer(int bytecount) throws Exception{
         this.bytecount = bytecount;
-        serversocket = new ServerSocket(PORT);
+        serversocket = new ServerSocket(0);
+    }
+
+    public int port() {
+        return serversocket.getLocalPort();
     }
 
     public void start() {