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