jdk/test/java/nio/channels/Selector/ConnectWrite.java
changeset 5970 d4e98bbfb0be
parent 5506 202f599c92aa
child 6538 cb0da65ba680
--- a/jdk/test/java/nio/channels/Selector/ConnectWrite.java	Tue Jun 22 19:18:06 2010 -0700
+++ b/jdk/test/java/nio/channels/Selector/ConnectWrite.java	Wed Jun 23 20:19:29 2010 +0100
@@ -45,8 +45,8 @@
         Selector selector = SelectorProvider.provider().openSelector();
         InetAddress myAddress=InetAddress.getByName(TestUtil.HOST);
         InetSocketAddress isa = new InetSocketAddress(myAddress, port);
+        SocketChannel sc = SocketChannel.open();
         try {
-            SocketChannel sc = SocketChannel.open();
             sc.configureBlocking(false);
             SelectionKey key = sc.register(selector, SelectionKey.OP_CONNECT);
             boolean result = sc.connect(isa);
@@ -80,6 +80,7 @@
                 }
             }
         } finally {
+            sc.close();
             selector.close();
         }
     }