EOFException thrown on BlackBerry when trying to open TLS connection with Connector.open()
-
29-04-2021 - |
Question
Sometimes I get EOFException
when I try to open a TLS connection over Wi-Fi with
Connector.open("tls://sub.domain.com:443;deviceside=true;interface=wifi;EndToEndRequired");
The call to Connector.open()
is blocking. The EOFException
is thrown about 10 seconds after the call to Connector.open(). Currently, I am unable to check what happens on the server side.
Edit:
The call to Connector.open() is made from a thread that is NOT the main event thread. The problem appears on various devices that run OS 6, though I don't think the problem is OS specific.
Any thoughts on how to solve this or what can be causing the error?
Update:
At some occasions, the call to Connector.open() also yields a TLSAlertException
wrapped inside TLSIOException
. The exception is not thrown immediately, but rather after about 10 seconds as previously mentioned EOFException
.
La solution
Finally, I was able to capture the TLS handshake on the server side and I saw the following:
- Server received the Client Hello message
- Server responded with Server Hello message
- Client key exchange was not received from the client for about 10 seconds
- Server closed the connection with the client
Since I see no way to influence on the Connector.open()
flow, the only thing I can do is retry (I never saw it happening twice in a row) after catch
ing either EOFException
or TLSAlertException
(and possibly other TLS related exceptions).