jdk/test/java/nio/channels/Selector/SelectAfterRead.java
changeset 5798 9cc262cd2a7a
parent 5506 202f599c92aa
child 7668 d4a77089c587
--- a/jdk/test/java/nio/channels/Selector/SelectAfterRead.java	Tue Jun 15 20:34:49 2010 -0700
+++ b/jdk/test/java/nio/channels/Selector/SelectAfterRead.java	Wed Jun 16 14:24:46 2010 +0100
@@ -37,14 +37,14 @@
     final static int TIMEOUT = 1000;
 
     public static void main(String[] argv) throws Exception {
+        InetAddress lh = InetAddress.getByName(ByteServer.LOCALHOST);
+
         // server: accept connection and write one byte
         ByteServer server = new ByteServer(1);
         server.start();
-        InetSocketAddress isa = new InetSocketAddress(
-                InetAddress.getByName(ByteServer.LOCALHOST), ByteServer.PORT);
         Selector sel = Selector.open();
         SocketChannel sc = SocketChannel.open();
-        sc.connect(isa);
+        sc.connect(new InetSocketAddress(lh, server.port()));
         sc.read(ByteBuffer.allocate(1));
         sc.configureBlocking(false);
         sc.register(sel, SelectionKey.OP_READ);
@@ -61,7 +61,7 @@
         server = new ByteServer(2);
         server.start();
         sc = SocketChannel.open();
-        sc.connect(isa);
+        sc.connect(new InetSocketAddress(lh, server.port()));
         sc.configureBlocking(false);
         sel = Selector.open();
         sc.register(sel, SelectionKey.OP_READ);