diff -r f338be3ef659 -r 7a31b0e0cfaf jdk/test/java/nio/channels/Selector/Alias.java --- a/jdk/test/java/nio/channels/Selector/Alias.java Wed Nov 07 10:49:19 2012 +0000 +++ b/jdk/test/java/nio/channels/Selector/Alias.java Wed Nov 07 13:24:39 2012 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2002, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 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 @@ -27,12 +27,11 @@ * @library .. */ -import java.io.*; import java.net.*; import java.nio.*; import java.nio.channels.*; +import java.nio.channels.spi.SelectorProvider; import java.util.*; -import java.nio.channels.spi.SelectorProvider; public class Alias { @@ -40,18 +39,26 @@ static int LIMIT = 20; // Hangs after just 1 if problem is present public static void main(String[] args) throws Exception { - test1(); + try (TestServers.DayTimeServer daytimeServer + = TestServers.DayTimeServer.startNewServer(100)) { + test1(daytimeServer); + } } - public static void test1() throws Exception { + static void test1(TestServers.DayTimeServer daytimeServer) throws Exception { Selector selector = SelectorProvider.provider().openSelector(); - InetAddress myAddress=InetAddress.getByName(TestUtil.HOST); - InetSocketAddress isa = new InetSocketAddress(myAddress,13); + InetAddress myAddress = daytimeServer.getAddress(); + InetSocketAddress isa + = new InetSocketAddress(myAddress, + daytimeServer.getPort()); for (int j=0; j