Basic.java revision 893
3909N/A * Copyright 2008-2009 Sun Microsystems, Inc. All Rights Reserved. 1189N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1189N/A * This code is free software; you can redistribute it and/or modify it 1189N/A * under the terms of the GNU General Public License version 2 only, as 1189N/A * published by the Free Software Foundation. 1189N/A * This code is distributed in the hope that it will be useful, but WITHOUT 1189N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1189N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1189N/A * version 2 for more details (a copy is included in the LICENSE file that 1189N/A * You should have received a copy of the GNU General Public License version 1189N/A * 2 along with this work; if not, write to the Free Software Foundation, 1189N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2362N/A * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 2362N/A * CA 95054 USA or visit www.sun.com if you need additional information or 1189N/A * @summary Unit test for AsynchronousChannelGroup 1189N/A // test shutdown with no channels in groups 1189N/A for (
int i=
0; i<
500; i++) {
// group should terminate quickly // shutdown with channel in group for (
int i=
0; i<
500; i++) {
// create channel that is bound to group // last channel so should terminate after this channel is closed // group should terminate quickly for (
int i=
0; i<
10; i++) {
// shutdownNow is required to close all channels // test creating channels in group after group is shutdown // attempt to create another channel // attempt to create another channel by connecting. This should cause // the accept operation to fail. throw new RuntimeException(
"IOException cause should be ShutdownChannelGroupException");
// initiate another accept even though channel group is shutdown. // connect to the listener which should cause the accept to complete throw new RuntimeException(
"IOException cause should be ShutdownChannelGroupException");
// group should *not* terminate as channels are open // close channel; group should terminate quickly