Check if hostname validation is supported before trying to use in test. (#8333)
Motivation:
a208f6dc7c
added a testcase which uses hostname validation which may not be supported by OpenSSL depending on the version that is used. We should check first before we try to use it.
Modifications:
Add assumeTrue(...) check to ensure hostname validation is supported before trying to run the test.
Result:
No more test-failures on OpenSSL versions < 1.0.2.
This commit is contained in:
parent
a208f6dc7c
commit
73acac13f4
|
@ -46,6 +46,7 @@ import io.netty.util.internal.PlatformDependent;
|
||||||
import io.netty.util.internal.StringUtil;
|
import io.netty.util.internal.StringUtil;
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
|
import org.junit.Assume;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.mockito.ArgumentCaptor;
|
import org.mockito.ArgumentCaptor;
|
||||||
|
@ -2421,6 +2422,12 @@ public abstract class SSLEngineTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testUsingX509TrustManagerVerifiesHostname() throws Exception {
|
public void testUsingX509TrustManagerVerifiesHostname() throws Exception {
|
||||||
|
SslProvider clientProvider = sslClientProvider();
|
||||||
|
if (clientProvider == SslProvider.OPENSSL || clientProvider == SslProvider.OPENSSL_REFCNT) {
|
||||||
|
// Need to check if we support hostname validation in the current used OpenSSL version before running
|
||||||
|
// the test.
|
||||||
|
Assume.assumeTrue(OpenSsl.supportsHostnameValidation());
|
||||||
|
}
|
||||||
SelfSignedCertificate cert = new SelfSignedCertificate();
|
SelfSignedCertificate cert = new SelfSignedCertificate();
|
||||||
clientSslCtx = SslContextBuilder
|
clientSslCtx = SslContextBuilder
|
||||||
.forClient()
|
.forClient()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user