I\'m developing an Android app which uses SSLSocket to connect to a server. This is the code I\'m using:
// Connect
if (socket == null || socket.isClosed() |
You are using a new SecureRandom per connection, instead of using a single static pre-initialized SecureRandom. Everytime you create a new SecureRandom(), you need to gather entropy for seeding (a slow process).
SecureRandom does not self-seed until it is first used, which is why the delay does not occur until the call to getSession()