I am using spring integration in one of my application to communicate with bank. On heavy load we are getting error "org.springframework.messaging.MessagingException: SSL Handshaking taking too long". Bank ask us to set timeout as 90 sec. While look into the code of TcpNioSSLConnection class, I found that 30 second is hardcoded.
private HandshakeStatus waitForHandshakeData(SSLEngineResult result,
HandshakeStatus status) thr`enter code here`ows IOException {
try {
if (logger.isTraceEnabled()) {
logger.trace("Writer waiting for handshake");
}
if (!TcpNioSSLConnection.this.semaphore.tryAcquire(30, TimeUnit.SECONDS)) {
throw new MessagingException("SSL Handshaking taking too long");
}
if (logger.isTraceEnabled()) {
logger.trace("Writer resuming handshake");
}
status = runTasksIfNeeded(result);
}
catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new MessagingException("Interrupted during SSL Handshaking");
}
return status;
}
Please suggest me if there any way to increase ssl handshake timeout
below is my spring integration connection factory configuration
<int-ip:tcp-connection-factory id="client"
type="client" port="${cbs.third.party.port}" host="${cbs.third.party.host}"
single-use="true" using-nio="true" deserializer="javaDeserializer"
serializer="javaSerializer" ssl-context-support="sslContextSupport" task-executor="myTaskExecutor"/>
Thanks, Rohit
There is currently no way to configure that timeout; I have opened a JIRA Issue.
You could try setting use-nio
to false
; unless you are opening a lot of sockets for long durations, it's not generally required.