File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed
lib/src/main/java/ua/naiksoftware/stomp Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change 11package ua .naiksoftware .stomp ;
22
3+ import android .os .Looper ;
34import android .util .Log ;
45
56import org .java_websocket .WebSocket ;
1718import java .util .Map ;
1819import java .util .TreeMap ;
1920
21+ import javax .net .ssl .SSLContext ;
22+ import javax .net .ssl .SSLSocketFactory ;
23+
2024import rx .Observable ;
2125import rx .Subscriber ;
2226
@@ -112,6 +116,17 @@ public void onError(Exception ex) {
112116 }
113117 };
114118
119+ if (mUri .startsWith ("wss" )) {
120+ try {
121+ SSLContext sc = SSLContext .getInstance ("TLS" );
122+ sc .init (null , null , null );
123+ SSLSocketFactory factory = sc .getSocketFactory ();
124+ mWebSocketClient .setSocket (factory .createSocket ());
125+ } catch (Exception e ) {
126+ e .printStackTrace ();
127+ }
128+ }
129+
115130 mWebSocketClient .connect ();
116131 haveConnection = true ;
117132 }
You can’t perform that action at this time.
0 commit comments