Janaki Sathiyamurthy
Janaki Sathiyamurthy

Reputation: 588

How to set Hostname in SSL Handshake (SNI) in JDK 1.7.x

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.

Upvotes: 6

Views: 2830

Answers (1)

CrackTheLogic
CrackTheLogic

Reputation: 29

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

Upvotes: 1

Related Questions