Hits java.net.SocketTimeoutExceptions upon trying to make a connection.
Timeout of 5000 ms is set, but the connection attempt fails in much less time than this.
This happens on a socket taking a long time to connect and the thread getting interrupted.
This behavior is seen in production, where the socket was
timing out much earlier than expected.
Update native code to work out the time spent in the "retry connect" loop correctly.
This problem is unlikely to occur that often in the field but is indeed an issue. The suggested fix in the comments section seems reasonable.