--- a/test/jdk/java/net/Socket/NullHost.java Thu Aug 08 18:44:11 2019 +0100
+++ b/test/jdk/java/net/Socket/NullHost.java Thu Aug 08 21:58:11 2019 +0100
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 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
@@ -36,7 +36,10 @@
public Server() throws IOException {
svr = new ServerSocket();
- svr.bind(new InetSocketAddress(0));
+ // The client side calls Socket((String) null, ...) which
+ // resolves to InetAddress.getByName((String)null) which in
+ // turns will resolve to the loopback address
+ svr.bind(new InetSocketAddress(InetAddress.getLoopbackAddress(), 0));
}
public int getPort() {