Skip to content

Commit

Permalink
[#402] Change default SSL HandshakeTimeout -1 -> 10s (see #146) (#411)
Browse files Browse the repository at this point in the history
  • Loading branch information
vharseko authored Sep 23, 2024
1 parent 0d81798 commit 88aec8f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
*
* Copyright 2010 Sun Microsystems, Inc.
* Portions Copyright 2011-2016 ForgeRock AS.
* Portions Copyright 2019-2024 3A Systems, LLC.
*/
package org.forgerock.opendj.grizzly;

Expand Down Expand Up @@ -830,7 +831,7 @@ void startTLS(final SSLContext sslContext, final List<String> protocols, final L

SSLEngineConfigurator serverSslEngineConfigurator = buildServerSSLEngineConfigurator(sslContext);
final SSLFilter sslFilter = new SSLFilter(serverSslEngineConfigurator, sslEngineConfigurator);
sslFilter.setHandshakeTimeout(getLongProperty("org.forgerock.opendj.grizzly.handshakeTimeout", sslFilter.getHandshakeTimeout(TimeUnit.MILLISECONDS)), TimeUnit.MILLISECONDS);
sslFilter.setHandshakeTimeout(getLongProperty("org.forgerock.opendj.grizzly.handshakeTimeout", 10000), TimeUnit.MILLISECONDS);
installFilter(sslFilter);
sslFilter.handshake(connection, completionHandler);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
*
* Copyright 2010 Sun Microsystems, Inc.
* Portions Copyright 2012-2016 ForgeRock AS.
* Portions Copyright 2017-2024 3A Systems, LLC.
*/
package org.forgerock.opendj.grizzly;

Expand Down Expand Up @@ -399,7 +400,7 @@ public boolean enableTLS(final SSLEngine sslEngine, final boolean startTls) {
}

SSLFilter sslFilter = new SSLFilter();
sslFilter.setHandshakeTimeout(getLongProperty("org.forgerock.opendj.grizzly.handshakeTimeout", sslFilter.getHandshakeTimeout(TimeUnit.MILLISECONDS)), TimeUnit.MILLISECONDS);
sslFilter.setHandshakeTimeout(getLongProperty("org.forgerock.opendj.grizzly.handshakeTimeout", 10000), TimeUnit.MILLISECONDS);
installFilter(startTls ? new StartTLSFilter(sslFilter) : sslFilter);
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
*
* Copyright 2010 Sun Microsystems, Inc.
* Portions Copyright 2011-2016 ForgeRock AS.
* Portions Copyright 2019-2024 3A Systems, LLC.
*/

package org.forgerock.opendj.grizzly;
Expand Down Expand Up @@ -565,12 +566,12 @@ public Void answer(InvocationOnMock invocation) throws Throwable {
assertThat(context.isClosed()).isFalse();
if (config.sendDisconnectNotification) {
context.disconnect(ResultCode.BUSY, "busy");
for(int i=1;i<10 && !context.isClosed() ;i++) {
Thread.sleep(100);
}
} else {
context.disconnect();
}
for(int i=1;i<100 && !context.isClosed() ;i++) {
Thread.sleep(100);
}
assertThat(context.isClosed()).isTrue();
}
// Block until remote close is signalled.
Expand Down

0 comments on commit 88aec8f

Please sign in to comment.