8225430: Replace wildcard address with loopback or local host in tests - part 14

Reviewed-by: dfuchs, chegar, vtewari
This commit is contained in:
Aleksei Efimov 2019-08-08 21:58:11 +01:00
parent 9f7cbf60e4
commit 4312f54e51
12 changed files with 108 additions and 52 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 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
@ -44,9 +44,11 @@ public class TestClose {
InetAddress ad1, ad2;
int port1, port2, serverport;
ss = new ServerSocket(0);
InetAddress loopback = InetAddress.getLoopbackAddress();
ss = new ServerSocket();
ss.bind(new InetSocketAddress(loopback, 0));
serverport = ss.getLocalPort();
s = new Socket("localhost", serverport);
s = new Socket(loopback, serverport);
s.close();
ss.close();
ad1 = ss.getInetAddress();