bump engine.io-client, add setDefaultHostnameVerifier method
This commit is contained in:
@@ -6,6 +6,7 @@ import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.JUnit4;
|
||||
|
||||
import javax.net.ssl.HostnameVerifier;
|
||||
import javax.net.ssl.KeyManagerFactory;
|
||||
import javax.net.ssl.SSLContext;
|
||||
import javax.net.ssl.TrustManagerFactory;
|
||||
@@ -20,15 +21,12 @@ import java.util.concurrent.LinkedBlockingQueue;
|
||||
@RunWith(JUnit4.class)
|
||||
public class SSLConnectionTest extends Connection {
|
||||
|
||||
static {
|
||||
// for test on localhost
|
||||
javax.net.ssl.HttpsURLConnection.setDefaultHostnameVerifier(
|
||||
new javax.net.ssl.HostnameVerifier(){
|
||||
public boolean verify(String hostname, javax.net.ssl.SSLSession sslSession) {
|
||||
return hostname.equals("localhost");
|
||||
}
|
||||
});
|
||||
}
|
||||
static HostnameVerifier hostnameVerifier = new javax.net.ssl.HostnameVerifier(){
|
||||
public boolean verify(String hostname, javax.net.ssl.SSLSession sslSession) {
|
||||
return hostname.equals("localhost");
|
||||
}
|
||||
};
|
||||
|
||||
private Socket socket;
|
||||
|
||||
@@ -68,6 +66,7 @@ public class SSLConnectionTest extends Connection {
|
||||
@After
|
||||
public void tearDown() {
|
||||
IO.setDefaultSSLContext(null);
|
||||
IO.setDefaultHostnameVerifier(null);
|
||||
}
|
||||
|
||||
@Test(timeout = TIMEOUT)
|
||||
@@ -75,6 +74,7 @@ public class SSLConnectionTest extends Connection {
|
||||
final BlockingQueue<Object> values = new LinkedBlockingQueue<Object>();
|
||||
IO.Options opts = createOptions();
|
||||
opts.sslContext = createSSLContext();
|
||||
opts.hostnameVerifier = hostnameVerifier;
|
||||
socket = client(opts);
|
||||
socket.on(Socket.EVENT_CONNECT, new Emitter.Listener() {
|
||||
@Override
|
||||
@@ -97,6 +97,7 @@ public class SSLConnectionTest extends Connection {
|
||||
public void defaultSSLContext() throws Exception {
|
||||
final BlockingQueue<Object> values = new LinkedBlockingQueue<Object>();
|
||||
IO.setDefaultSSLContext(createSSLContext());
|
||||
IO.setDefaultHostnameVerifier(hostnameVerifier);
|
||||
socket = client();
|
||||
socket.on(Socket.EVENT_CONNECT, new Emitter.Listener() {
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user