While I was developing a Homer application for Android, I met frustrating problem with delays on ssl connection. Homer uses ssl for every http request, so I decided use HttpsURLConnection class for this job. Everything was fine until you run Homer in LAN without access to internet. Than, unexpectedly, every request started taking about 5 to 10 seconds. If you connect the internet, everything was fine back.
I resigned from HttpsUrlConnection and made directly communication using sockets. However, it didn’t solve problem – every call to SSLSocket.getSession() took the same 5 to 10 seconds as before.
Finaly, I found solution. There is a bug in Android prior to 4.0 version, which makes reverse DNS lookup for every https request. So, when you have no access to dns servers, it takes long time. To fix problem you can use code from: