63
63
import org .junit .After ;
64
64
import quickfix .mina .SocksProxyServer ;
65
65
66
- import static org .junit .Assert .assertEquals ;
67
66
import static org .junit .Assert .assertSame ;
67
+ import static org .junit .Assert .assertTrue ;
68
68
69
69
public class SSLCertificateTest {
70
70
@@ -191,7 +191,7 @@ public void shouldAuthenticateServerNameUsingServerCommonName() throws Exception
191
191
192
192
TestInitiator initiator = new TestInitiator (
193
193
createInitiatorSettings ("single-session/empty.keystore" , "single-session/client-cn.truststore" ,
194
- CIPHER_SUITES_TLS , "TLSv1.2" , "ZULU" , "ALFA" , Integer .toString (freePort ), "JKS" , "JKS" ));
194
+ CIPHER_SUITES_TLS , "TLSv1.2" , "ZULU" , "ALFA" , Integer .toString (freePort ), "JKS" , "JKS" , "HTTPS" ));
195
195
196
196
try {
197
197
initiator .start ();
@@ -226,7 +226,7 @@ public void shouldAuthenticateServerNameUsingSNIExtension() throws Exception {
226
226
227
227
TestInitiator initiator = new TestInitiator (
228
228
createInitiatorSettings ("single-session/empty.keystore" , "single-session/client-sni.truststore" ,
229
- CIPHER_SUITES_TLS , "TLSv1.2" , "ZULU" , "ALFA" , Integer .toString (freePort ), "JKS" , "JKS" ));
229
+ CIPHER_SUITES_TLS , "TLSv1.2" , "ZULU" , "ALFA" , Integer .toString (freePort ), "JKS" , "JKS" , "HTTPS" ));
230
230
231
231
try {
232
232
initiator .start ();
@@ -786,7 +786,7 @@ public void assertSslExceptionThrown() throws Exception {
786
786
assertSslExceptionThrown (null , null );
787
787
}
788
788
789
- public void assertSslExceptionThrown (String errorMessage , Class <?> errorType ) throws Exception {
789
+ public void assertSslExceptionThrown (String expectedErrorMessage , Class <?> expectedErrorType ) throws Exception {
790
790
boolean reachedZero = exceptionThrownLatch .await (TIMEOUT_SECONDS , TimeUnit .SECONDS );
791
791
792
792
if (!reachedZero ) {
@@ -795,12 +795,14 @@ public void assertSslExceptionThrown(String errorMessage, Class<?> errorType) th
795
795
796
796
Throwable throwable = exception .get ();
797
797
798
- if (errorMessage != null ) {
799
- assertEquals (errorMessage , throwable .getMessage ());
798
+ if (expectedErrorMessage != null ) {
799
+ String thrownErrorMessage = throwable .getMessage ();
800
+ assertTrue ("Thrown error message: " + thrownErrorMessage + " does not contain: " + expectedErrorMessage ,
801
+ thrownErrorMessage != null && thrownErrorMessage .contains (expectedErrorMessage ));
800
802
}
801
803
802
- if (errorType != null ) {
803
- assertSame (errorType , throwable .getClass ());
804
+ if (expectedErrorType != null ) {
805
+ assertSame (expectedErrorType , throwable .getClass ());
804
806
}
805
807
}
806
808
0 commit comments