8280546: Remove hard-coded 127.0.0.1 loopback address

Reviewed-by: mullan
This commit is contained in:
Liam Miller-Cushon 2022-01-26 17:40:17 +00:00
parent 0c42e43f77
commit b5de2cc9d3
2 changed files with 5 additions and 2 deletions
test/jdk/javax/net/ssl

@ -21,12 +21,13 @@
* questions.
*/
import java.net.InetAddress;
import java.security.Provider;
import java.security.Security;
public class TestJSSE {
private static final String LOCAL_IP = "127.0.0.1";
private static final String LOCAL_IP = InetAddress.getLoopbackAddress().getHostAddress();
public static void main(String... args) throws Exception {
// reset the security property to make sure that the algorithms

@ -23,6 +23,7 @@
import java.io.InputStream;
import java.io.OutputStream;
import java.net.InetAddress;
import java.security.cert.Certificate;
import javax.net.ssl.KeyManager;
@ -52,7 +53,8 @@ class JSSEClient extends CipherTest.Client {
new TrustManager[] { CipherTest.trustManager },
CipherTest.secureRandom);
SSLSocketFactory factory = (SSLSocketFactory)sslContext.getSocketFactory();
socket = (SSLSocket)factory.createSocket("127.0.0.1", CipherTest.serverPort);
socket = (SSLSocket)factory.createSocket(
InetAddress.getLoopbackAddress().getHostAddress(), CipherTest.serverPort);
socket.setSoTimeout(CipherTest.TIMEOUT);
socket.setEnabledCipherSuites(new String[] { params.cipherSuite.name() });
socket.setEnabledProtocols(new String[] { params.protocol.name });