test/java/nio/channels/Selector/KeysReady.java

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. --- 1,7 ---- /* ! * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation.
*** 26,50 **** * @summary Test if keys reported ready multiple times * @library .. */ import java.net.*; - import java.io.*; - import java.nio.*; import java.nio.channels.*; - import java.nio.charset.*; import java.nio.channels.spi.SelectorProvider; public class KeysReady { ! static final int DAYTIME_PORT = 13; ! static final String DAYTIME_HOST = TestUtil.HOST; ! ! static void test() throws Exception { InetSocketAddress isa ! = new InetSocketAddress(InetAddress.getByName(DAYTIME_HOST), ! DAYTIME_PORT); SocketChannel sc = SocketChannel.open(); sc.configureBlocking(false); sc.connect(isa); // Prepare a selector --- 26,44 ---- * @summary Test if keys reported ready multiple times * @library .. */ import java.net.*; import java.nio.channels.*; import java.nio.channels.spi.SelectorProvider; public class KeysReady { ! static void test(TestClass.DayTimeServer dayTimeServer) throws Exception { InetSocketAddress isa ! = new InetSocketAddress(dayTimeServer.getAddress(), ! dayTimeServer.getPort()); SocketChannel sc = SocketChannel.open(); sc.configureBlocking(false); sc.connect(isa); // Prepare a selector
*** 62,70 **** sc.close(); } } public static void main(String[] args) throws Exception { ! test(); } } --- 56,67 ---- sc.close(); } } public static void main(String[] args) throws Exception { ! try (TestClass.DayTimeServer daytimeServer ! = TestClass.DayTimeServer.startNewServer(50)) { ! test(daytimeServer); ! } } }