Thanks a lot rr! for your suggestions.. my problem was solved..
I added the cipher suites as the one you gave..
props.setProperty("oracle.net.ssl_cipher_suites", "(TLS_RSA_WITH_AES_128_CBC_SHA256,TLS_RSA_WITH_AES_256_CBC_SHA,TLS_RSA_WITH_AES_128_CBC_SHA)");
Also imported the server certificate to 'cacerts' with the below command and it worked after that.. :)
keytool -import -alias localhost -file C:/Users//openSSL/ssl/certs/nginx-selfsigned.crt -storetype JKS -keystore cacerts