@Manan,
Two things I would like to say
1) ==============================================================
You said that you problem is solved. But if you still want to explore this area more
You might like to try these sample programs, that make a socket connection over ssl.
http://javakafunda.blogspot.in/2012/04/sample-program-to-test-ssl-connection.html
You can also visit the source URL given in this post if required.
I was able to make a socket connection, when both client and server were on the same machine. But Don't know, it didn't work for me when i actually tested in production (I was getting a handshake failure msg).
If you would like to try them out, please do that, I would like to know the results you get with these programs.
2)====================================================================
Rest all looks OK with the steps you are doing
But what I feel like is that
you should be setting these value in trustStore rather than keyStore
WrongValues
System.setProperty("javax.net.ssl.keyStore", "D:/Documents/tmpkeystore.jks");
System.setProperty("javax.net.ssl.keyStorePassword", "12345678");
System.setProperty("javax.net.ssl.keyStoreType", "JKS");
Right Values
System.setProperty("javax.net.ssl.trustStore", "D:/Documents/tmpkeystore.jks");
System.setProperty("javax.net.ssl.trustStorePassword", "12345678");
System.setProperty("javax.net.ssl.trustStoreType", "JKS");
Reason for setting the trustStore, I will explain to you once it works.