@@ -67,6 +67,13 @@ public void test_localServer_ServerLocalhost_Client127_CheckInactive() throws Ce
67
67
assertFalse (client .onSSLError );
68
68
}
69
69
70
+ @ Test (timeout =2000 )
71
+ public void test_localServer_ServerLocalhost_Client127_CheckDefault () throws CertificateException , UnrecoverableKeyException , NoSuchAlgorithmException , KeyManagementException , KeyStoreException , IOException , URISyntaxException , InterruptedException {
72
+ SSLWebSocketClient client = testIssueWithLocalServer ("127.0.0.1" , SocketUtil .getAvailablePort (), SSLContextUtil .getLocalhostOnlyContext (), SSLContextUtil .getLocalhostOnlyContext (), null );
73
+ assertFalse (client .onOpen );
74
+ assertTrue (client .onSSLError );
75
+ }
76
+
70
77
@ Test (timeout =2000 )
71
78
public void test_localServer_ServerLocalhost_ClientLocalhost_CheckActive () throws CertificateException , UnrecoverableKeyException , NoSuchAlgorithmException , KeyManagementException , KeyStoreException , IOException , URISyntaxException , InterruptedException {
72
79
SSLWebSocketClient client = testIssueWithLocalServer ("localhost" , SocketUtil .getAvailablePort (), SSLContextUtil .getLocalhostOnlyContext (), SSLContextUtil .getLocalhostOnlyContext (), "HTTPS" );
@@ -80,6 +87,13 @@ public void test_localServer_ServerLocalhost_ClientLocalhost_CheckInactive() thr
80
87
assertFalse (client .onSSLError );
81
88
}
82
89
90
+ @ Test (timeout =2000 )
91
+ public void test_localServer_ServerLocalhost_ClientLocalhost_CheckDefault () throws CertificateException , UnrecoverableKeyException , NoSuchAlgorithmException , KeyManagementException , KeyStoreException , IOException , URISyntaxException , InterruptedException {
92
+ SSLWebSocketClient client = testIssueWithLocalServer ("localhost" , SocketUtil .getAvailablePort (), SSLContextUtil .getLocalhostOnlyContext (), SSLContextUtil .getLocalhostOnlyContext (), null );
93
+ assertTrue (client .onOpen );
94
+ assertFalse (client .onSSLError );
95
+ }
96
+
83
97
84
98
public SSLWebSocketClient testIssueWithLocalServer (String address , int port , SSLContext serverContext , SSLContext clientContext , String endpointIdentificationAlgorithm ) throws IOException , URISyntaxException , InterruptedException {
85
99
CountDownLatch countServerDownLatch = new CountDownLatch (1 );
@@ -129,9 +143,7 @@ public void onError(Exception ex) {
129
143
130
144
@ Override
131
145
protected void onSetSSLParameters (SSLParameters sslParameters ) {
132
- if (endpointIdentificationAlgorithm == null ) {
133
- super .onSetSSLParameters (sslParameters );
134
- } else {
146
+ if (endpointIdentificationAlgorithm != null ) {
135
147
sslParameters .setEndpointIdentificationAlgorithm (endpointIdentificationAlgorithm );
136
148
}
137
149
}
0 commit comments