6965150: TEST_BUG: java/nio/channels/AsynchronousSocketChannel/Basic.java takes too long

Chris Hegarty chris.hegarty at oracle.com
Wed Jun 30 02:13:15 PDT 2010


Alan, this change looks fine since you are just checking that the 
channel is no longer open.

-Chris.

On 06/29/10 19:15, Alan Bateman wrote:
>
> Chris - do you mind looking at another test fix? Hopefully this is the
> latest of the test fixes for a while. The patch here is to
> test/java/nio/channels/AsynchronousSocketChannel/Basic.java. That test
> takes up to 4mins with most of the time spent testing the connect method
> where the underlying connect needs to timeout. I've just replaced this
> connect with an attempt to establish a local connection and so it will
> fail immediately.
>
> Thanks,
>
> -Alan.
>
>
>
> diff --git a/test/java/nio/channels/AsynchronousSocketChannel/Basic.java
> b/test/java/nio/channels/AsynchronousSocketChannel/Basic.java
> --- a/test/java/nio/channels/AsynchronousSocketChannel/Basic.java
> +++ b/test/java/nio/channels/AsynchronousSocketChannel/Basic.java
> @@ -194,12 +194,13 @@ public class Basic {
> if (!(connectException.get() instanceof ClosedChannelException))
> throw new RuntimeException("ClosedChannelException expected");
>
> - System.out.println("-- connect to non-existent host --");
> + // shutdown listener
> + server.close();
>
> // test that failure to connect closes the channel
> ch = AsynchronousSocketChannel.open();
> try {
> - ch.connect(genSocketAddress()).get();
> + ch.connect(server.address()).get();
> } catch (ExecutionException x) {
> // failed to establish connection
> if (ch.isOpen())
> @@ -207,8 +208,6 @@ public class Basic {
> } finally {
> ch.close();
> }
> -
> - server.close();
> }
>
> static void testCloseWhenPending() throws Exception {
>
>
>


More information about the nio-dev mailing list