JDK 1.8 seems to be providing the following option to explicitly set Hostname for connecting to SNI enabled sites,
SNIHostName serverName = new SNIHostName("www.example.com");
List<SNIServerName> serverNames = new ArrayList<>(1);
serverNames.add(serverName);
sslParameters.setServerNames(serverNames);
Is there any similar way to do in JDK 1.7. I have already set jsse.enableSNIExtension=true. I need to explicitly set hostname. Any help is much appreciated.
There is no way to set SNIHostName in Java 7. We can set using Java 8 only.
You can refer to below URL for more details. http://javabreaks.blogspot.com/2015/12/java-ssl-handshake-with-server-name.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With