Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@
import org.junit.After;
import quickfix.mina.SocksProxyServer;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;

public class SSLCertificateTest {

Expand Down Expand Up @@ -191,7 +191,7 @@ public void shouldAuthenticateServerNameUsingServerCommonName() throws Exception

TestInitiator initiator = new TestInitiator(
createInitiatorSettings("single-session/empty.keystore", "single-session/client-cn.truststore",
CIPHER_SUITES_TLS, "TLSv1.2", "ZULU", "ALFA", Integer.toString(freePort), "JKS", "JKS"));
CIPHER_SUITES_TLS, "TLSv1.2", "ZULU", "ALFA", Integer.toString(freePort), "JKS", "JKS", "HTTPS"));

try {
initiator.start();
Expand Down Expand Up @@ -226,7 +226,7 @@ public void shouldAuthenticateServerNameUsingSNIExtension() throws Exception {

TestInitiator initiator = new TestInitiator(
createInitiatorSettings("single-session/empty.keystore", "single-session/client-sni.truststore",
CIPHER_SUITES_TLS, "TLSv1.2", "ZULU", "ALFA", Integer.toString(freePort), "JKS", "JKS"));
CIPHER_SUITES_TLS, "TLSv1.2", "ZULU", "ALFA", Integer.toString(freePort), "JKS", "JKS", "HTTPS"));

try {
initiator.start();
Expand Down Expand Up @@ -786,7 +786,7 @@ public void assertSslExceptionThrown() throws Exception {
assertSslExceptionThrown(null, null);
}

public void assertSslExceptionThrown(String errorMessage, Class<?> errorType) throws Exception {
public void assertSslExceptionThrown(String expectedErrorMessage, Class<?> expectedErrorType) throws Exception {
boolean reachedZero = exceptionThrownLatch.await(TIMEOUT_SECONDS, TimeUnit.SECONDS);

if (!reachedZero) {
Expand All @@ -795,12 +795,14 @@ public void assertSslExceptionThrown(String errorMessage, Class<?> errorType) th

Throwable throwable = exception.get();

if (errorMessage != null) {
assertEquals(errorMessage, throwable.getMessage());
if (expectedErrorMessage != null) {
String thrownErrorMessage = throwable.getMessage();
assertTrue("Thrown error message: " + thrownErrorMessage + " does not contain: " + expectedErrorMessage,
thrownErrorMessage != null && thrownErrorMessage.contains(expectedErrorMessage));
}

if (errorType != null) {
assertSame(errorType, throwable.getClass());
if (expectedErrorType != null) {
assertSame(expectedErrorType, throwable.getClass());
}
}

Expand Down
Loading