--- old/test/java/nio/channels/SocketChannel/Basic.java 2012-10-30 18:40:26.000000000 +0100 +++ new/test/java/nio/channels/SocketChannel/Basic.java 2012-10-30 18:40:26.000000000 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 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 @@ -36,13 +36,9 @@ static java.io.PrintStream out = System.out; - 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); + static void test(TestUtil.DayTimeServer daytimeServer) throws Exception { + InetSocketAddress isa = new InetSocketAddress(daytimeServer.getAddress(), + daytimeServer.getPort()); SocketChannel sc = SocketChannel.open(isa); out.println("opened: " + sc); /* @@ -76,7 +72,10 @@ } public static void main(String[] args) throws Exception { - test(); + try (TestUtil.DayTimeServer dayTimeServer = + TestUtil.DayTimeServer.startNewServer(100)) { + test(dayTimeServer); + } } }