I am referring to this JSSE Reference Guide and doing handshake with my Webserver with an SNI Hostname and getting the public certificate.
Only for a particular SNI Domain, when I try to get the Pub-Cert with ssl-handshake I am getting the below exception
Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
It comes exactly when i wrap the data using sslEngine.wrap(myAppData, myNetData);
Am not sure how to tackle it ..
But when i try to do the handshake from my linux-terminal with the below command, it works perfectly fine ..
/usr/bin/openssl s_client -connect api.sys.mm.d1.cf.company.com:443 -servername www.myapp.company.com 2>/dev/null