fix #6 enable to set SSLContext
This commit is contained in:
@@ -3,6 +3,7 @@ package com.github.nkzawa.socketio.client;
|
||||
|
||||
import com.github.nkzawa.socketio.parser.Parser;
|
||||
|
||||
import javax.net.ssl.SSLContext;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
@@ -22,6 +23,9 @@ public class IO {
|
||||
*/
|
||||
public static int protocol = Parser.protocol;
|
||||
|
||||
public static void setDefaultSSLContext(SSLContext sslContext) {
|
||||
Manager.defaultSSLContext = sslContext;
|
||||
}
|
||||
|
||||
private IO() {}
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.github.nkzawa.socketio.parser.Packet;
|
||||
import com.github.nkzawa.socketio.parser.Parser;
|
||||
import com.github.nkzawa.thread.EventThread;
|
||||
|
||||
import javax.net.ssl.SSLContext;
|
||||
import java.net.URI;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedList;
|
||||
@@ -62,6 +63,8 @@ public class Manager extends Emitter {
|
||||
|
||||
public static final String EVENT_RECONNECT_ATTEMPT = "reconnect_attempt";
|
||||
|
||||
/*package*/ static SSLContext defaultSSLContext;
|
||||
|
||||
/*package*/ ReadyState readyState = null;
|
||||
|
||||
private boolean _reconnection;
|
||||
@@ -111,6 +114,9 @@ public class Manager extends Emitter {
|
||||
if (opts.path == null) {
|
||||
opts.path = "/socket.io";
|
||||
}
|
||||
if (opts.sslContext == null) {
|
||||
opts.sslContext = defaultSSLContext;
|
||||
}
|
||||
this.opts = opts;
|
||||
this.nsps = new ConcurrentHashMap<String, Socket>();
|
||||
this.subs = new LinkedList<On.Handle>();
|
||||
|
||||
Reference in New Issue
Block a user