8334928: Test sun/security/ssl/SSLSocketImpl/ReuseAddr.java failed: java.net.BindException: Address already in use

Reviewed-by: rhalade
This commit is contained in:
Neha Joshi 2025-11-26 06:16:08 +00:00 committed by SendaoYan
parent e13dfd3ec3
commit cdf5fbed9b
2 changed files with 5 additions and 2 deletions

View File

@ -190,6 +190,7 @@ public class SSLSocketTemplate extends SSLContextTemplate {
try {
sslServerSocket.setSoTimeout(30000);
sslSocket = (SSLSocket)sslServerSocket.accept();
System.out.println("Connection established on port : " +serverPort);
} catch (SocketTimeoutException ste) {
// Ignore the test case if no connection within 30 seconds.
System.out.println(
@ -228,6 +229,7 @@ public class SSLSocketTemplate extends SSLContextTemplate {
}
} finally {
sslSocket.close();
System.out.println("Connection closed on port : " +serverPort);
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2025, 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
@ -38,7 +38,7 @@ import java.net.BindException;
public class ReuseAddr extends SSLSocketTemplate {
private static final int MAX_ATTEMPTS = 3;
private static final int MAX_ATTEMPTS = 15;
@Override
protected void doServerSide() throws Exception {
@ -65,6 +65,7 @@ public class ReuseAddr extends SSLSocketTemplate {
System.err.println(msg);
throw new AssertionError("Failed to reuse address: " + msg, x);
} else {
Thread.sleep(100*i);
System.out.println("Retrying...");
}
}