File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed
lib/src/main/java/ua/naiksoftware/stomp Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change 33import android .util .Log ;
44
55import org .java_websocket .WebSocket ;
6+ import org .java_websocket .client .DefaultSSLWebSocketClientFactory ;
67import org .java_websocket .client .WebSocketClient ;
78import org .java_websocket .drafts .Draft_17 ;
89import org .java_websocket .exceptions .InvalidDataException ;
1718import java .util .Map ;
1819import java .util .TreeMap ;
1920
21+ import javax .net .ssl .SSLContext ;
22+
2023import rx .Observable ;
2124import rx .Subscriber ;
2225
@@ -107,6 +110,17 @@ public void onError(Exception ex) {
107110 emitLifecycleEvent (new LifecycleEvent (LifecycleEvent .Type .ERROR , ex ));
108111 }
109112 };
113+
114+ if (mUri .startsWith ("wss" )) {
115+ try {
116+ SSLContext sc = SSLContext .getInstance ("TLS" );
117+ sc .init (null , null , null );
118+ mWebSocketClient .setWebSocketFactory (new DefaultSSLWebSocketClientFactory (sc ));
119+ } catch (Exception e ) {
120+ e .printStackTrace ();
121+ }
122+ }
123+
110124 mWebSocketClient .connect ();
111125 haveConnection = true ;
112126 }
You can’t perform that action at this time.
0 commit comments