Skip to content

Commit

Permalink
8280546: Remove hard-coded 127.0.0.1 loopback address
Browse files Browse the repository at this point in the history
Backport-of: b5de2cc9d36e1fad7d0bf70f7c83ff829e16b7f3
  • Loading branch information
GoeLin committed Apr 1, 2024
1 parent d27c9ba commit e922114
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion test/jdk/javax/net/ssl/TLS/TestJSSE.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion test/jdk/javax/net/ssl/sanity/interop/JSSEClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -52,7 +53,8 @@ void runTest(CipherTest.TestParameters params) throws Exception {
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 });
Expand Down

1 comment on commit e922114

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.