8

I am making an SSL connection to the server every 30 seconds, and cants stand the overhead of the SSL Handshake which takes almost 6K. What i want to do is use SSL Session Resumption (make my client use SID received from the server in previous session)

i have read this post: Reusing SSL Sessions in Android with HttpClient but the magic solution of removing the line of registry.register(new Scheme("http", PlainSocketFactory.getSocketFactory(), 80)); just doesnt work for me (i see it in wireshark when the client sends no session id) even though it has one.

Is there a better example of using SSLSessionCache / SSLCertificateSocketFactory on android? thanks

Community
  • 1
  • 1
koyaya
  • 111
  • 5
  • Try to change the port number to 443 – Dharmendra Oct 09 '11 at 20:18
  • http://stackoverflow.com/questions/7105681/https-connection-with-basic-auth-result-into-unauthorized may be this link help you – Dharmendra Oct 09 '11 at 20:18
  • 1
    Dharmendra: thanks for your answer, but this is not what i wanted.. i am not asking about how to do an httpget or post, but how to make ssl session resumption – koyaya Oct 10 '11 at 07:49
  • I didn't test but i think that key for session cache is (host,port) of createSocket(Socket s, String host, int port, boolean autoClose), where host and port can actualy be totaly different form host and port of socket. – philippe lhardy Mar 05 '13 at 18:28
  • I know it is a bit late ... I've a similar problem http://stackoverflow.com/q/15946228/194609 but did you try to check if this works with your browser? If not then your server might be not configured to save the ssl session – Karussell Apr 11 '13 at 11:04

1 Answers1

-1

Dpes it help to use a longer keep alive?

mHttpClient.setKeepAliveStrategy(new ConnectionKeepAliveStrategy() { 
    @Override 
    public long getKeepAliveDuration(HttpResponse response, HttpContext context) { 
        return 60 * 1000;
    } 
}); 
Sofi Software LLC
  • 3,879
  • 1
  • 36
  • 34