use of org.junit.AssumptionViolatedException in project netty by netty.
the class OpenSslEngineTest method testWrapWithDifferentSizes.
private void testWrapWithDifferentSizes(SSLEngineTestParam param, String protocol, String cipher) throws Exception {
assumeTrue(OpenSsl.SUPPORTED_PROTOCOLS_SET.contains(protocol));
if (!OpenSsl.isCipherSuiteAvailable(cipher)) {
return;
}
SSLEngine clientEngine = null;
SSLEngine serverEngine = null;
try {
clientEngine = wrapEngine(clientSslCtx.newEngine(UnpooledByteBufAllocator.DEFAULT));
serverEngine = wrapEngine(serverSslCtx.newEngine(UnpooledByteBufAllocator.DEFAULT));
clientEngine.setEnabledCipherSuites(new String[] { cipher });
clientEngine.setEnabledProtocols(new String[] { protocol });
serverEngine.setEnabledCipherSuites(new String[] { cipher });
serverEngine.setEnabledProtocols(new String[] { protocol });
try {
handshake(param.type(), param.delegate(), clientEngine, serverEngine);
} catch (SSLException e) {
if (e.getMessage().contains("unsupported protocol") || e.getMessage().contains("no protocols available")) {
throw new AssumptionViolatedException(protocol + " not supported with cipher " + cipher, e);
}
throw e;
}
int srcLen = 64;
do {
testWrapDstBigEnough(param.type(), clientEngine, srcLen);
srcLen += 64;
} while (srcLen < MAX_PLAINTEXT_LENGTH);
testWrapDstBigEnough(param.type(), clientEngine, MAX_PLAINTEXT_LENGTH);
} finally {
cleanupClientSslEngine(clientEngine);
cleanupServerSslEngine(serverEngine);
}
}
use of org.junit.AssumptionViolatedException in project netty by netty.
the class JdkSslEngineTest method testTlsExtensionNoCompatibleProtocolsNoHandshakeFailure.
@MethodSource("newJdkParams")
@ParameterizedTest
public void testTlsExtensionNoCompatibleProtocolsNoHandshakeFailure(JdkSSLEngineTestParam param) throws Exception {
try {
param.providerType.activate(this);
ApplicationProtocolConfig clientApn = acceptingNegotiator(param.providerType.protocol(), PREFERRED_APPLICATION_LEVEL_PROTOCOL);
ApplicationProtocolConfig serverApn = acceptingNegotiator(param.providerType.protocol(), APPLICATION_LEVEL_PROTOCOL_NOT_COMPATIBLE);
setupHandlers(param, serverApn, clientApn);
runTest(null);
} catch (SkipTestException e) {
// java version incompatibility don't fail the test, but instead just skip the test
throw new AssumptionViolatedException("Not expected", e);
}
}
use of org.junit.AssumptionViolatedException in project netty by netty.
the class JdkSslEngineTest method testTlsExtensionNoCompatibleProtocolsServerHandshakeFailure.
@MethodSource("newJdkParams")
@ParameterizedTest
public void testTlsExtensionNoCompatibleProtocolsServerHandshakeFailure(JdkSSLEngineTestParam param) throws Exception {
try {
param.providerType.activate(this);
ApplicationProtocolConfig clientApn = acceptingNegotiator(param.providerType.protocol(), PREFERRED_APPLICATION_LEVEL_PROTOCOL);
ApplicationProtocolConfig serverApn = failingNegotiator(param.providerType.protocol(), APPLICATION_LEVEL_PROTOCOL_NOT_COMPATIBLE);
setupHandlers(param, serverApn, clientApn);
assertTrue(serverLatch.await(2, TimeUnit.SECONDS));
assertTrue(serverException instanceof SSLHandshakeException);
} catch (SkipTestException e) {
// java version incompatibility don't fail the test, but instead just skip the test
throw new AssumptionViolatedException("Not expected", e);
}
}
use of org.junit.AssumptionViolatedException in project netty by netty.
the class JdkSslEngineTest method testTlsExtension.
@MethodSource("newJdkParams")
@ParameterizedTest
public void testTlsExtension(JdkSSLEngineTestParam param) throws Exception {
try {
param.providerType.activate(this);
ApplicationProtocolConfig apn = failingNegotiator(param.providerType.protocol(), PREFERRED_APPLICATION_LEVEL_PROTOCOL);
setupHandlers(param, apn);
runTest();
} catch (SkipTestException e) {
// java version incompatibility don't fail the test, but instead just skip the test
throw new AssumptionViolatedException("Not expected", e);
}
}
use of org.junit.AssumptionViolatedException in project randomizedtesting by randomizedtesting.
the class RandomizedRunner method reportAsIgnored.
void reportAsIgnored(RunNotifier notifier, GroupEvaluator ge, TestCandidate c) {
if (c.method.getAnnotation(Ignore.class) != null) {
notifier.fireTestIgnored(c.description);
return;
}
String ignoreReason = ge.getIgnoreReason(c.method, suiteClass);
if (ignoreReason != null) {
notifier.fireTestStarted(c.description);
notifier.fireTestAssumptionFailed(new Failure(c.description, new AssumptionViolatedException(ignoreReason)));
notifier.fireTestFinished(c.description);
}
}
Aggregations