I need to connect to spring websocket server which supports SNI. I am using Spring WebSocket Client which by default does not sends SNI extension as jdk 1.8.0 does not send SNI extension by default.
Extended server_name (SNI Extension) not sent with jdk1.8.0 but send with jdk1.7.0
The official documentation of java suggests to add SNI Matcher with SSLParameters and set the SSLParameters to SSLSocket before making any HttpsUrlConnection with that SSLSocket.
https://docs.oracle.com/javase/8/docs/technotes/guides/security/jsse/JSSERefGuide.html#SNIExtension
Is there any way to set this property with Spring WebSocket Client ?
There are some ClientEndpointCongfig properties that can be set as per given link but I did not find any property which can be used to set SSLSocket or SSLSocketfactory with the Spring websocket client.
https://tomcat.apache.org/tomcat-8.5-doc/web-socket-howto.html
Here is a sample code for Spring websocket client:
List<Transport> transports = new ArrayList<>(1);
StandardWebSocketClient standardWebSocketClient = new StandardWebSocketClient();
transports.add(new WebSocketTransport( standardWebSocketClient) );
WebSocketClient transport = new SockJsClient(transports);
WebSocketStompClient stompClient = new WebSocketStompClient(transport);
StompSessionHandler sessionHandler = new MyStompSessionHandler();
stompClient.connect(URL, sessionHandler);