Skip to content

Commit cdf5fbe

Browse files
nehajoshinjSendaoYan
authored andcommitted
8334928: Test sun/security/ssl/SSLSocketImpl/ReuseAddr.java failed: java.net.BindException: Address already in use
Reviewed-by: rhalade
1 parent e13dfd3 commit cdf5fbe

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

test/jdk/javax/net/ssl/templates/SSLSocketTemplate.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@ protected void doServerSide() throws Exception {
190190
try {
191191
sslServerSocket.setSoTimeout(30000);
192192
sslSocket = (SSLSocket)sslServerSocket.accept();
193+
System.out.println("Connection established on port : " +serverPort);
193194
} catch (SocketTimeoutException ste) {
194195
// Ignore the test case if no connection within 30 seconds.
195196
System.out.println(
@@ -228,6 +229,7 @@ protected void doServerSide() throws Exception {
228229
}
229230
} finally {
230231
sslSocket.close();
232+
System.out.println("Connection closed on port : " +serverPort);
231233
}
232234
}
233235

test/jdk/sun/security/ssl/SSLSocketImpl/ReuseAddr.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2001, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -38,7 +38,7 @@
3838

3939
public class ReuseAddr extends SSLSocketTemplate {
4040

41-
private static final int MAX_ATTEMPTS = 3;
41+
private static final int MAX_ATTEMPTS = 15;
4242

4343
@Override
4444
protected void doServerSide() throws Exception {
@@ -65,6 +65,7 @@ public static void main(String[] args) throws Exception {
6565
System.err.println(msg);
6666
throw new AssertionError("Failed to reuse address: " + msg, x);
6767
} else {
68+
Thread.sleep(100*i);
6869
System.out.println("Retrying...");
6970
}
7071
}

0 commit comments

Comments
 (0)