add setDefaultHostnameVerifier
This commit is contained in:
@@ -98,6 +98,7 @@ public class Socket extends Emitter {
|
|||||||
private static boolean priorWebsocketSuccess = false;
|
private static boolean priorWebsocketSuccess = false;
|
||||||
|
|
||||||
private static SSLContext defaultSSLContext;
|
private static SSLContext defaultSSLContext;
|
||||||
|
private static HostnameVerifier defaultHostnameVerifier;
|
||||||
|
|
||||||
private boolean secure;
|
private boolean secure;
|
||||||
private boolean upgrade;
|
private boolean upgrade;
|
||||||
@@ -131,6 +132,10 @@ public class Socket extends Emitter {
|
|||||||
defaultSSLContext = sslContext;
|
defaultSSLContext = sslContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void setDefaultHostnameVerifier(HostnameVerifier hostnameVerifier) {
|
||||||
|
defaultHostnameVerifier = hostnameVerifier;
|
||||||
|
}
|
||||||
|
|
||||||
public Socket() {
|
public Socket() {
|
||||||
this(new Options());
|
this(new Options());
|
||||||
}
|
}
|
||||||
@@ -199,7 +204,7 @@ public class Socket extends Emitter {
|
|||||||
opts.transports : new String[]{Polling.NAME, WebSocket.NAME}));
|
opts.transports : new String[]{Polling.NAME, WebSocket.NAME}));
|
||||||
this.policyPort = opts.policyPort != 0 ? opts.policyPort : 843;
|
this.policyPort = opts.policyPort != 0 ? opts.policyPort : 843;
|
||||||
this.rememberUpgrade = opts.rememberUpgrade;
|
this.rememberUpgrade = opts.rememberUpgrade;
|
||||||
this.hostnameVerifier = opts.hostnameVerifier;
|
this.hostnameVerifier = opts.hostnameVerifier != null ? opts.hostnameVerifier : defaultHostnameVerifier;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -126,9 +126,8 @@ public class SSLConnectionTest extends Connection {
|
|||||||
final BlockingQueue<Object> values = new LinkedBlockingQueue<Object>();
|
final BlockingQueue<Object> values = new LinkedBlockingQueue<Object>();
|
||||||
|
|
||||||
Socket.setDefaultSSLContext(createSSLContext());
|
Socket.setDefaultSSLContext(createSSLContext());
|
||||||
Socket.Options opts = createOptions();
|
Socket.setDefaultHostnameVerifier(SSLConnectionTest.hostnameVerifier);
|
||||||
opts.hostnameVerifier = SSLConnectionTest.hostnameVerifier;
|
socket = new Socket(createOptions());
|
||||||
socket = new Socket(opts);
|
|
||||||
socket.on(Socket.EVENT_OPEN, new Emitter.Listener() {
|
socket.on(Socket.EVENT_OPEN, new Emitter.Listener() {
|
||||||
@Override
|
@Override
|
||||||
public void call(Object... args) {
|
public void call(Object... args) {
|
||||||
|
|||||||
Reference in New Issue
Block a user