File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed
Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -125,14 +125,19 @@ socket.on("foo", new Emitter.Listener() {
125125SSL (HTTPS, WSS) settings:
126126
127127``` java
128+ OkHttpClient okHttpClient = new OkHttpClient .Builder ()
129+ .hostnameVerifier(myHostnameVerifier)
130+ .sslSocketFactory(mySSLContext. getSocketFactory(), myX509TrustManager)
131+ .build();
132+
128133// default settings for all sockets
129- IO . setDefaultSSLContext(mySSLContext );
130- IO . setDefaultHostnameVerifier(myHostnameVerifier );
134+ Socket . setDefaultOkHttpWebSocketFactory(okHttpClient );
135+ Socket . setDefaultOkHttpCallFactory(okHttpClient );
131136
132137// set as an option
133138opts = new IO .Options ();
134- opts. sslContext = mySSLContext ;
135- opts. hostnameVerifier = myHostnameVerifier ;
139+ opts. callFactory = okHttpClient ;
140+ opts. webSocketFactory = okHttpClient ;
136141socket = IO . socket(" https://localhost" , opts);
137142```
138143
You can’t perform that action at this time.
0 commit comments