Skip NPN tests when libressl 2.6.1+ is used.
Motivation: LibreSSL removed support for NPN in its 2.6.1+ releases. Modifications: Skip NPN tests in libressl 2.6.1+ Result: Be able to run netty tests against libressl 2.6.1+ as well.
This commit is contained in:
parent
6e6cfa0604
commit
40af10b782
@ -131,8 +131,37 @@ public class OpenSslEngineTest extends SSLEngineTest {
|
|||||||
super.testClientHostnameValidationFail();
|
super.testClientHostnameValidationFail();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static boolean isNpnSupported(String versionString) {
|
||||||
|
String[] versionStringParts = versionString.split(" ", -1);
|
||||||
|
if (versionStringParts.length == 2 && "LibreSSL".equals(versionStringParts[0])) {
|
||||||
|
String[] versionParts = versionStringParts[1].split("\\.", -1);
|
||||||
|
if (versionParts.length == 3) {
|
||||||
|
int major = Integer.parseInt(versionParts[0]);
|
||||||
|
if (major < 2) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (major > 2) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
int minor = Integer.parseInt(versionParts[1]);
|
||||||
|
if (minor < 6) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (minor > 6) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
int bugfix = Integer.parseInt(versionParts[2]);
|
||||||
|
if (bugfix > 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
@Test
|
@Test
|
||||||
public void testNpn() throws Exception {
|
public void testNpn() throws Exception {
|
||||||
|
String versionString = OpenSsl.versionString();
|
||||||
|
assumeTrue("LibreSSL 2.6.1 removed NPN support, detected " + versionString, isNpnSupported(versionString));
|
||||||
ApplicationProtocolConfig apn = acceptingNegotiator(Protocol.NPN,
|
ApplicationProtocolConfig apn = acceptingNegotiator(Protocol.NPN,
|
||||||
PREFERRED_APPLICATION_LEVEL_PROTOCOL);
|
PREFERRED_APPLICATION_LEVEL_PROTOCOL);
|
||||||
setupHandlers(apn);
|
setupHandlers(apn);
|
||||||
|
@ -1009,7 +1009,7 @@ public abstract class SSLEngineTest {
|
|||||||
SslHandler handler = channel.pipeline().get(SslHandler.class);
|
SslHandler handler = channel.pipeline().get(SslHandler.class);
|
||||||
assertNotNull(handler);
|
assertNotNull(handler);
|
||||||
String appProto = handler.applicationProtocol();
|
String appProto = handler.applicationProtocol();
|
||||||
assertEquals(appProto, expectedApplicationProtocol);
|
assertEquals(expectedApplicationProtocol, appProto);
|
||||||
|
|
||||||
SSLEngine engine = handler.engine();
|
SSLEngine engine = handler.engine();
|
||||||
if (engine instanceof Java9SslEngine) {
|
if (engine instanceof Java9SslEngine) {
|
||||||
|
Loading…
Reference in New Issue
Block a user