File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
src/main/java/tech/gusavila92/websocketclient Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -134,6 +134,9 @@ public abstract class WebSocketClient {
134134 */
135135 private volatile Thread reconnectionThread ;
136136
137+
138+ private SSLSocketFactory socketFactory = (SSLSocketFactory ) SSLSocketFactory .getDefault ();
139+
137140 /**
138141 * Initialize all the variables
139142 *
@@ -152,6 +155,11 @@ public WebSocketClient(URI uri) {
152155 webSocketConnection = new WebSocketConnection ();
153156 }
154157
158+
159+ public void setSSLSocketFactory (SSLSocketFactory sslSocketFactory ) {
160+ socketFactory = sslSocketFactory ;
161+ }
162+
155163 /**
156164 * Called when the WebSocket handshake has been accepted and the WebSocket
157165 * is ready to send and receive data
@@ -648,7 +656,6 @@ private boolean createAndConnectTCPSocket() throws IOException {
648656 socket .connect (new InetSocketAddress (uri .getHost (), 80 ), connectTimeout );
649657 }
650658 } else if (scheme .equals ("wss" )) {
651- SSLSocketFactory socketFactory = (SSLSocketFactory ) SSLSocketFactory .getDefault ();
652659 socket = socketFactory .createSocket ();
653660 socket .setSoTimeout (readTimeout );
654661
You can’t perform that action at this time.
0 commit comments