test/jdk/java/net/Socket/ShutdownInput.java
changeset 55645 3203e857fa71
parent 54811 9db7c0f561a6
--- a/test/jdk/java/net/Socket/ShutdownInput.java	Wed Jul 10 07:27:58 2019 -0700
+++ b/test/jdk/java/net/Socket/ShutdownInput.java	Wed Jul 10 16:09:20 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, 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
@@ -47,9 +47,9 @@
     public static void main(String args[]) throws Exception {
         IPSupport.throwSkippedExceptionIfNonOperational();
 
-        InetAddress iaddr = InetAddress.getLocalHost();
+        InetAddress iaddr = InetAddress.getLoopbackAddress();
 
-        try ( ServerSocket ss = new ServerSocket(0);
+        try (ServerSocket ss = new ServerSocket(0, 0, iaddr);
               Socket s1 = new Socket(iaddr, ss.getLocalPort());
               Socket s2 = ss.accept() ) {
 
@@ -57,7 +57,8 @@
         }
 
         // check the NIO socket adapter
-        try (ServerSocketChannel sc = ServerSocketChannel.open().bind(null);
+        InetSocketAddress socketAddress = new InetSocketAddress(iaddr, 0);
+        try (ServerSocketChannel sc = ServerSocketChannel.open().bind(socketAddress);
              SocketChannel s1 = SocketChannel.open(
                      new InetSocketAddress(iaddr, sc.socket().getLocalPort()));
              SocketChannel s2 = sc.accept() ) {