72746032b1
The content of this branch was automatically imported from Fedora ELN with the following as its source: https://src.fedoraproject.org/rpms/netty#342e6b392cd905be34a8918ca862d2dca9a3dcd8
634 lines
26 KiB
Diff
634 lines
26 KiB
Diff
From 14fa8d4afda0fa1a31a2591298dc5c18e08dab1f Mon Sep 17 00:00:00 2001
|
|
From: Mat Booth <mat.booth@redhat.com>
|
|
Date: Mon, 7 Sep 2020 12:17:31 +0100
|
|
Subject: [PATCH 1/5] Remove optional dep Blockhound
|
|
|
|
---
|
|
common/pom.xml | 5 -
|
|
.../java/io/netty/util/internal/Hidden.java | 113 ---------
|
|
...ockhound.integration.BlockHoundIntegration | 14 -
|
|
pom.xml | 7 -
|
|
transport-blockhound-tests/pom.xml | 92 -------
|
|
.../NettyBlockHoundIntegrationTest.java | 239 ------------------
|
|
.../netty/util/internal/localhost_server.key | 28 --
|
|
.../netty/util/internal/localhost_server.pem | 17 --
|
|
.../io/netty/util/internal/mutual_auth_ca.pem | 19 --
|
|
9 files changed, 534 deletions(-)
|
|
delete mode 100644 common/src/main/java/io/netty/util/internal/Hidden.java
|
|
delete mode 100644 common/src/main/resources/META-INF/services/reactor.blockhound.integration.BlockHoundIntegration
|
|
delete mode 100644 transport-blockhound-tests/pom.xml
|
|
delete mode 100644 transport-blockhound-tests/src/test/java/io/netty/util/internal/NettyBlockHoundIntegrationTest.java
|
|
delete mode 100644 transport-blockhound-tests/src/test/resources/io/netty/util/internal/localhost_server.key
|
|
delete mode 100644 transport-blockhound-tests/src/test/resources/io/netty/util/internal/localhost_server.pem
|
|
delete mode 100644 transport-blockhound-tests/src/test/resources/io/netty/util/internal/mutual_auth_ca.pem
|
|
|
|
diff --git a/common/pom.xml b/common/pom.xml
|
|
index 706279177a..abc73161eb 100644
|
|
--- a/common/pom.xml
|
|
+++ b/common/pom.xml
|
|
@@ -78,11 +78,6 @@
|
|
<artifactId>log4j-core</artifactId>
|
|
<scope>test</scope>
|
|
</dependency>
|
|
- <dependency>
|
|
- <groupId>io.projectreactor.tools</groupId>
|
|
- <artifactId>blockhound</artifactId>
|
|
- <optional>true</optional>
|
|
- </dependency>
|
|
<dependency>
|
|
<groupId>org.mockito</groupId>
|
|
<artifactId>mockito-core</artifactId>
|
|
diff --git a/common/src/main/java/io/netty/util/internal/Hidden.java b/common/src/main/java/io/netty/util/internal/Hidden.java
|
|
deleted file mode 100644
|
|
index 7fd6d08396..0000000000
|
|
--- a/common/src/main/java/io/netty/util/internal/Hidden.java
|
|
+++ /dev/null
|
|
@@ -1,113 +0,0 @@
|
|
-/*
|
|
- * Copyright 2019 The Netty Project
|
|
- *
|
|
- * The Netty Project licenses this file to you under the Apache License,
|
|
- * version 2.0 (the "License"); you may not use this file except in compliance
|
|
- * with the License. You may obtain a copy of the License at:
|
|
- *
|
|
- * http://www.apache.org/licenses/LICENSE-2.0
|
|
- *
|
|
- * Unless required by applicable law or agreed to in writing, software
|
|
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
- * License for the specific language governing permissions and limitations
|
|
- * under the License.
|
|
- */
|
|
-
|
|
-package io.netty.util.internal;
|
|
-
|
|
-import io.netty.util.concurrent.FastThreadLocalThread;
|
|
-import reactor.blockhound.BlockHound;
|
|
-import reactor.blockhound.integration.BlockHoundIntegration;
|
|
-
|
|
-import java.util.function.Function;
|
|
-import java.util.function.Predicate;
|
|
-
|
|
-/**
|
|
- * Contains classes that must be have public visibility but are not public API.
|
|
- */
|
|
-class Hidden {
|
|
-
|
|
- /**
|
|
- * This class integrates Netty with BlockHound.
|
|
- * <p>
|
|
- * It is public but only because of the ServiceLoader's limitations
|
|
- * and SHOULD NOT be considered a public API.
|
|
- */
|
|
- @UnstableApi
|
|
- @SuppressJava6Requirement(reason = "BlockHound is Java 8+, but this class is only loaded by it's SPI")
|
|
- public static final class NettyBlockHoundIntegration implements BlockHoundIntegration {
|
|
-
|
|
- @Override
|
|
- public void applyTo(BlockHound.Builder builder) {
|
|
- builder.allowBlockingCallsInside(
|
|
- "io.netty.channel.nio.NioEventLoop",
|
|
- "handleLoopException"
|
|
- );
|
|
-
|
|
- builder.allowBlockingCallsInside(
|
|
- "io.netty.channel.kqueue.KQueueEventLoop",
|
|
- "handleLoopException"
|
|
- );
|
|
-
|
|
- builder.allowBlockingCallsInside(
|
|
- "io.netty.channel.epoll.EpollEventLoop",
|
|
- "handleLoopException"
|
|
- );
|
|
-
|
|
- builder.allowBlockingCallsInside(
|
|
- "io.netty.util.HashedWheelTimer$Worker",
|
|
- "waitForNextTick"
|
|
- );
|
|
-
|
|
- builder.allowBlockingCallsInside(
|
|
- "io.netty.util.concurrent.SingleThreadEventExecutor",
|
|
- "confirmShutdown"
|
|
- );
|
|
-
|
|
- builder.allowBlockingCallsInside(
|
|
- "io.netty.handler.ssl.SslHandler",
|
|
- "handshake"
|
|
- );
|
|
-
|
|
- builder.allowBlockingCallsInside(
|
|
- "io.netty.handler.ssl.SslHandler",
|
|
- "runAllDelegatedTasks"
|
|
- );
|
|
-
|
|
- builder.allowBlockingCallsInside(
|
|
- "io.netty.util.concurrent.GlobalEventExecutor",
|
|
- "takeTask");
|
|
-
|
|
- builder.allowBlockingCallsInside(
|
|
- "io.netty.util.concurrent.GlobalEventExecutor",
|
|
- "addTask");
|
|
-
|
|
- builder.allowBlockingCallsInside(
|
|
- "io.netty.util.concurrent.SingleThreadEventExecutor",
|
|
- "takeTask");
|
|
-
|
|
- builder.allowBlockingCallsInside(
|
|
- "io.netty.handler.ssl.ReferenceCountedOpenSslClientContext$ExtendedTrustManagerVerifyCallback",
|
|
- "verify");
|
|
-
|
|
- builder.nonBlockingThreadPredicate(new Function<Predicate<Thread>, Predicate<Thread>>() {
|
|
- @Override
|
|
- public Predicate<Thread> apply(final Predicate<Thread> p) {
|
|
- return new Predicate<Thread>() {
|
|
- @Override
|
|
- @SuppressJava6Requirement(reason = "Predicate#test")
|
|
- public boolean test(Thread thread) {
|
|
- return p.test(thread) || thread instanceof FastThreadLocalThread;
|
|
- }
|
|
- };
|
|
- }
|
|
- });
|
|
- }
|
|
-
|
|
- @Override
|
|
- public int compareTo(BlockHoundIntegration o) {
|
|
- return 0;
|
|
- }
|
|
- }
|
|
-}
|
|
diff --git a/common/src/main/resources/META-INF/services/reactor.blockhound.integration.BlockHoundIntegration b/common/src/main/resources/META-INF/services/reactor.blockhound.integration.BlockHoundIntegration
|
|
deleted file mode 100644
|
|
index 5cf376dd8c..0000000000
|
|
--- a/common/src/main/resources/META-INF/services/reactor.blockhound.integration.BlockHoundIntegration
|
|
+++ /dev/null
|
|
@@ -1,14 +0,0 @@
|
|
-# Copyright 2019 The Netty Project
|
|
-#
|
|
-# The Netty Project licenses this file to you under the Apache License,
|
|
-# version 2.0 (the "License"); you may not use this file except in compliance
|
|
-# with the License. You may obtain a copy of the License at:
|
|
-#
|
|
-# http://www.apache.org/licenses/LICENSE-2.0
|
|
-#
|
|
-# Unless required by applicable law or agreed to in writing, software
|
|
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
-# License for the specific language governing permissions and limitations
|
|
-# under the License.
|
|
-io.netty.util.internal.Hidden$NettyBlockHoundIntegration
|
|
\ No newline at end of file
|
|
diff --git a/pom.xml b/pom.xml
|
|
index d00e3e88e0..d548aa5513 100644
|
|
--- a/pom.xml
|
|
+++ b/pom.xml
|
|
@@ -416,7 +416,6 @@
|
|
<module>testsuite-osgi</module>
|
|
<module>testsuite-shading</module>
|
|
<module>testsuite-native-image</module>
|
|
- <module>transport-blockhound-tests</module>
|
|
<module>microbench</module>
|
|
<module>bom</module>
|
|
</modules>
|
|
@@ -717,12 +716,6 @@
|
|
<scope>test</scope>
|
|
</dependency>
|
|
|
|
- <!-- BlockHound integration -->
|
|
- <dependency>
|
|
- <groupId>io.projectreactor.tools</groupId>
|
|
- <artifactId>blockhound</artifactId>
|
|
- <version>1.0.3.RELEASE</version>
|
|
- </dependency>
|
|
</dependencies>
|
|
</dependencyManagement>
|
|
|
|
diff --git a/transport-blockhound-tests/pom.xml b/transport-blockhound-tests/pom.xml
|
|
deleted file mode 100644
|
|
index 359accd3c4..0000000000
|
|
--- a/transport-blockhound-tests/pom.xml
|
|
+++ /dev/null
|
|
@@ -1,92 +0,0 @@
|
|
-<?xml version="1.0" encoding="UTF-8"?>
|
|
-<!--
|
|
- ~ Copyright 2019 The Netty Project
|
|
- ~
|
|
- ~ The Netty Project licenses this file to you under the Apache License,
|
|
- ~ version 2.0 (the "License"); you may not use this file except in compliance
|
|
- ~ with the License. You may obtain a copy of the License at:
|
|
- ~
|
|
- ~ http://www.apache.org/licenses/LICENSE-2.0
|
|
- ~
|
|
- ~ Unless required by applicable law or agreed to in writing, software
|
|
- ~ distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
- ~ WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
- ~ License for the specific language governing permissions and limitations
|
|
- ~ under the License.
|
|
- -->
|
|
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
|
-
|
|
- <modelVersion>4.0.0</modelVersion>
|
|
- <parent>
|
|
- <groupId>io.netty</groupId>
|
|
- <artifactId>netty-parent</artifactId>
|
|
- <version>4.1.51.Final</version>
|
|
- </parent>
|
|
-
|
|
- <artifactId>netty-transport-blockhound-tests</artifactId>
|
|
- <packaging>jar</packaging>
|
|
- <description>
|
|
- Tests for the BlockHound integration.
|
|
- </description>
|
|
-
|
|
- <name>Netty/Transport/BlockHound/Tests</name>
|
|
-
|
|
- <profiles>
|
|
- <profile>
|
|
- <id>java13</id>
|
|
- <activation>
|
|
- <jdk>13</jdk>
|
|
- </activation>
|
|
- <properties>
|
|
- <argLine.common>-XX:+AllowRedefinitionToAddDeleteMethods</argLine.common>
|
|
- </properties>
|
|
- </profile>
|
|
- <profile>
|
|
- <id>java14</id>
|
|
- <activation>
|
|
- <jdk>14</jdk>
|
|
- </activation>
|
|
- <properties>
|
|
- <argLine.common>-XX:+AllowRedefinitionToAddDeleteMethods</argLine.common>
|
|
- </properties>
|
|
- </profile>
|
|
- </profiles>
|
|
-
|
|
- <properties>
|
|
- <maven.compiler.source>1.8</maven.compiler.source>
|
|
- <maven.compiler.target>1.8</maven.compiler.target>
|
|
- <!-- Needed for SelfSignedCertificate -->
|
|
- <argLine.java9.extras>--add-exports java.base/sun.security.x509=ALL-UNNAMED</argLine.java9.extras>
|
|
- <skipJapicmp>true</skipJapicmp>
|
|
- </properties>
|
|
-
|
|
- <dependencies>
|
|
- <dependency>
|
|
- <groupId>${project.groupId}</groupId>
|
|
- <artifactId>netty-transport</artifactId>
|
|
- <version>${project.version}</version>
|
|
- </dependency>
|
|
- <dependency>
|
|
- <groupId>${project.groupId}</groupId>
|
|
- <artifactId>netty-handler</artifactId>
|
|
- <version>${project.version}</version>
|
|
- </dependency>
|
|
- <dependency>
|
|
- <groupId>${project.groupId}</groupId>
|
|
- <artifactId>${tcnative.artifactId}</artifactId>
|
|
- <classifier>${tcnative.classifier}</classifier>
|
|
- <optional>true</optional>
|
|
- </dependency>
|
|
-
|
|
- <dependency>
|
|
- <groupId>org.bouncycastle</groupId>
|
|
- <artifactId>bcpkix-jdk15on</artifactId>
|
|
- <optional>true</optional>
|
|
- </dependency>
|
|
- <dependency>
|
|
- <groupId>io.projectreactor.tools</groupId>
|
|
- <artifactId>blockhound</artifactId>
|
|
- <scope>test</scope>
|
|
- </dependency>
|
|
- </dependencies>
|
|
-</project>
|
|
diff --git a/transport-blockhound-tests/src/test/java/io/netty/util/internal/NettyBlockHoundIntegrationTest.java b/transport-blockhound-tests/src/test/java/io/netty/util/internal/NettyBlockHoundIntegrationTest.java
|
|
deleted file mode 100644
|
|
index 58e9284370..0000000000
|
|
--- a/transport-blockhound-tests/src/test/java/io/netty/util/internal/NettyBlockHoundIntegrationTest.java
|
|
+++ /dev/null
|
|
@@ -1,239 +0,0 @@
|
|
-/*
|
|
- * Copyright 2019 The Netty Project
|
|
-
|
|
- * The Netty Project licenses this file to you under the Apache License,
|
|
- * version 2.0 (the "License"); you may not use this file except in compliance
|
|
- * with the License. You may obtain a copy of the License at:
|
|
-
|
|
- * http://www.apache.org/licenses/LICENSE-2.0
|
|
-
|
|
- * Unless required by applicable law or agreed to in writing, software
|
|
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
- * License for the specific language governing permissions and limitations
|
|
- * under the License.
|
|
- */
|
|
-package io.netty.util.internal;
|
|
-
|
|
-import io.netty.bootstrap.Bootstrap;
|
|
-import io.netty.bootstrap.ServerBootstrap;
|
|
-import io.netty.buffer.UnpooledByteBufAllocator;
|
|
-import io.netty.channel.Channel;
|
|
-import io.netty.channel.ChannelFuture;
|
|
-import io.netty.channel.ChannelHandlerContext;
|
|
-import io.netty.channel.ChannelInboundHandlerAdapter;
|
|
-import io.netty.channel.ChannelInitializer;
|
|
-import io.netty.channel.EventLoopGroup;
|
|
-import io.netty.channel.nio.NioEventLoopGroup;
|
|
-import io.netty.channel.socket.nio.NioServerSocketChannel;
|
|
-import io.netty.channel.socket.nio.NioSocketChannel;
|
|
-import io.netty.handler.ssl.SslContext;
|
|
-import io.netty.handler.ssl.SslContextBuilder;
|
|
-import io.netty.handler.ssl.SslHandler;
|
|
-import io.netty.handler.ssl.SslHandshakeCompletionEvent;
|
|
-import io.netty.handler.ssl.SslProvider;
|
|
-import io.netty.handler.ssl.util.InsecureTrustManagerFactory;
|
|
-import io.netty.handler.ssl.util.SelfSignedCertificate;
|
|
-import io.netty.util.ReferenceCountUtil;
|
|
-import io.netty.util.concurrent.DefaultThreadFactory;
|
|
-import io.netty.util.concurrent.EventExecutor;
|
|
-import io.netty.util.concurrent.GlobalEventExecutor;
|
|
-import io.netty.util.concurrent.ImmediateEventExecutor;
|
|
-import io.netty.util.concurrent.ImmediateExecutor;
|
|
-import io.netty.util.concurrent.ScheduledFuture;
|
|
-import io.netty.util.concurrent.SingleThreadEventExecutor;
|
|
-import io.netty.util.internal.Hidden.NettyBlockHoundIntegration;
|
|
-import org.hamcrest.Matchers;
|
|
-import org.junit.BeforeClass;
|
|
-import org.junit.Test;
|
|
-import reactor.blockhound.BlockHound;
|
|
-import reactor.blockhound.BlockingOperationError;
|
|
-import reactor.blockhound.integration.BlockHoundIntegration;
|
|
-
|
|
-import java.net.InetSocketAddress;
|
|
-import java.util.ServiceLoader;
|
|
-import java.util.concurrent.CountDownLatch;
|
|
-import java.util.concurrent.ExecutionException;
|
|
-import java.util.concurrent.Executor;
|
|
-import java.util.concurrent.ExecutorService;
|
|
-import java.util.concurrent.Executors;
|
|
-import java.util.concurrent.FutureTask;
|
|
-import java.util.concurrent.TimeUnit;
|
|
-
|
|
-import static org.junit.Assert.assertThat;
|
|
-import static org.junit.Assert.assertTrue;
|
|
-import static org.junit.Assert.fail;
|
|
-
|
|
-public class NettyBlockHoundIntegrationTest {
|
|
-
|
|
- @BeforeClass
|
|
- public static void setUpClass() {
|
|
- BlockHound.install();
|
|
- }
|
|
-
|
|
- @Test
|
|
- public void testServiceLoader() {
|
|
- for (BlockHoundIntegration integration : ServiceLoader.load(BlockHoundIntegration.class)) {
|
|
- if (integration instanceof NettyBlockHoundIntegration) {
|
|
- return;
|
|
- }
|
|
- }
|
|
-
|
|
- fail("NettyBlockHoundIntegration cannot be loaded with ServiceLoader");
|
|
- }
|
|
-
|
|
- @Test
|
|
- public void testBlockingCallsInNettyThreads() throws Exception {
|
|
- final FutureTask<Void> future = new FutureTask<>(() -> {
|
|
- Thread.sleep(0);
|
|
- return null;
|
|
- });
|
|
- GlobalEventExecutor.INSTANCE.execute(future);
|
|
-
|
|
- try {
|
|
- future.get(5, TimeUnit.SECONDS);
|
|
- fail("Expected an exception due to a blocking call but none was thrown");
|
|
- } catch (ExecutionException e) {
|
|
- assertThat(e.getCause(), Matchers.instanceOf(BlockingOperationError.class));
|
|
- }
|
|
- }
|
|
-
|
|
- @Test(timeout = 5000L)
|
|
- public void testGlobalEventExecutorTakeTask() throws InterruptedException {
|
|
- testEventExecutorTakeTask(GlobalEventExecutor.INSTANCE);
|
|
- }
|
|
-
|
|
- @Test(timeout = 5000L)
|
|
- public void testSingleThreadEventExecutorTakeTask() throws InterruptedException {
|
|
- SingleThreadEventExecutor executor =
|
|
- new SingleThreadEventExecutor(null, new DefaultThreadFactory("test"), true) {
|
|
- @Override
|
|
- protected void run() {
|
|
- while (!confirmShutdown()) {
|
|
- Runnable task = takeTask();
|
|
- if (task != null) {
|
|
- task.run();
|
|
- }
|
|
- }
|
|
- }
|
|
- };
|
|
- testEventExecutorTakeTask(executor);
|
|
- }
|
|
-
|
|
- private static void testEventExecutorTakeTask(EventExecutor eventExecutor) throws InterruptedException {
|
|
- CountDownLatch latch = new CountDownLatch(1);
|
|
- ScheduledFuture<?> f = eventExecutor.schedule(latch::countDown, 10, TimeUnit.MILLISECONDS);
|
|
- f.sync();
|
|
- latch.await();
|
|
- }
|
|
-
|
|
- // Tests copied from io.netty.handler.ssl.SslHandlerTest
|
|
- @Test
|
|
- public void testHandshakeWithExecutorThatExecuteDirectory() throws Exception {
|
|
- testHandshakeWithExecutor(Runnable::run);
|
|
- }
|
|
-
|
|
- @Test
|
|
- public void testHandshakeWithImmediateExecutor() throws Exception {
|
|
- testHandshakeWithExecutor(ImmediateExecutor.INSTANCE);
|
|
- }
|
|
-
|
|
- @Test
|
|
- public void testHandshakeWithImmediateEventExecutor() throws Exception {
|
|
- testHandshakeWithExecutor(ImmediateEventExecutor.INSTANCE);
|
|
- }
|
|
-
|
|
- @Test
|
|
- public void testHandshakeWithExecutor() throws Exception {
|
|
- ExecutorService executorService = Executors.newCachedThreadPool();
|
|
- try {
|
|
- testHandshakeWithExecutor(executorService);
|
|
- } finally {
|
|
- executorService.shutdown();
|
|
- }
|
|
- }
|
|
-
|
|
- @Test
|
|
- public void testTrustManagerVerify() throws Exception {
|
|
- final SslContext sslClientCtx =
|
|
- SslContextBuilder.forClient()
|
|
- .trustManager(ResourcesUtil.getFile(getClass(), "mutual_auth_ca.pem"))
|
|
- .build();
|
|
-
|
|
- final SslContext sslServerCtx =
|
|
- SslContextBuilder.forServer(ResourcesUtil.getFile(getClass(), "localhost_server.pem"),
|
|
- ResourcesUtil.getFile(getClass(), "localhost_server.key"),
|
|
- null)
|
|
- .build();
|
|
-
|
|
- final SslHandler clientSslHandler = sslClientCtx.newHandler(UnpooledByteBufAllocator.DEFAULT);
|
|
- final SslHandler serverSslHandler = sslServerCtx.newHandler(UnpooledByteBufAllocator.DEFAULT);
|
|
-
|
|
- testHandshake(sslClientCtx, clientSslHandler, serverSslHandler);
|
|
- }
|
|
-
|
|
- private static void testHandshakeWithExecutor(Executor executor) throws Exception {
|
|
- String tlsVersion = "TLSv1.2";
|
|
- final SslContext sslClientCtx = SslContextBuilder.forClient()
|
|
- .trustManager(InsecureTrustManagerFactory.INSTANCE)
|
|
- .sslProvider(SslProvider.JDK).protocols(tlsVersion).build();
|
|
-
|
|
- final SelfSignedCertificate cert = new SelfSignedCertificate();
|
|
- final SslContext sslServerCtx = SslContextBuilder.forServer(cert.key(), cert.cert())
|
|
- .sslProvider(SslProvider.JDK).protocols(tlsVersion).build();
|
|
-
|
|
- final SslHandler clientSslHandler = sslClientCtx.newHandler(UnpooledByteBufAllocator.DEFAULT, executor);
|
|
- final SslHandler serverSslHandler = sslServerCtx.newHandler(UnpooledByteBufAllocator.DEFAULT, executor);
|
|
-
|
|
- testHandshake(sslClientCtx, clientSslHandler, serverSslHandler);
|
|
- }
|
|
-
|
|
- private static void testHandshake(SslContext sslClientCtx, SslHandler clientSslHandler,
|
|
- SslHandler serverSslHandler) throws Exception {
|
|
- EventLoopGroup group = new NioEventLoopGroup();
|
|
- Channel sc = null;
|
|
- Channel cc = null;
|
|
- try {
|
|
- sc = new ServerBootstrap()
|
|
- .group(group)
|
|
- .channel(NioServerSocketChannel.class)
|
|
- .childHandler(serverSslHandler)
|
|
- .bind(new InetSocketAddress(0)).syncUninterruptibly().channel();
|
|
-
|
|
- ChannelFuture future = new Bootstrap()
|
|
- .group(group)
|
|
- .channel(NioSocketChannel.class)
|
|
- .handler(new ChannelInitializer<Channel>() {
|
|
- @Override
|
|
- protected void initChannel(Channel ch) {
|
|
- ch.pipeline()
|
|
- .addLast(clientSslHandler)
|
|
- .addLast(new ChannelInboundHandlerAdapter() {
|
|
-
|
|
- @Override
|
|
- public void userEventTriggered(ChannelHandlerContext ctx, Object evt) {
|
|
- if (evt instanceof SslHandshakeCompletionEvent &&
|
|
- ((SslHandshakeCompletionEvent) evt).cause() != null) {
|
|
- ((SslHandshakeCompletionEvent) evt).cause().printStackTrace();
|
|
- }
|
|
- ctx.fireUserEventTriggered(evt);
|
|
- }
|
|
- });
|
|
- }
|
|
- }).connect(sc.localAddress());
|
|
- cc = future.syncUninterruptibly().channel();
|
|
-
|
|
- assertTrue(clientSslHandler.handshakeFuture().await().isSuccess());
|
|
- assertTrue(serverSslHandler.handshakeFuture().await().isSuccess());
|
|
- } finally {
|
|
- if (cc != null) {
|
|
- cc.close().syncUninterruptibly();
|
|
- }
|
|
- if (sc != null) {
|
|
- sc.close().syncUninterruptibly();
|
|
- }
|
|
- group.shutdownGracefully();
|
|
- ReferenceCountUtil.release(sslClientCtx);
|
|
- }
|
|
- }
|
|
-}
|
|
diff --git a/transport-blockhound-tests/src/test/resources/io/netty/util/internal/localhost_server.key b/transport-blockhound-tests/src/test/resources/io/netty/util/internal/localhost_server.key
|
|
deleted file mode 100644
|
|
index 9aa6611400..0000000000
|
|
--- a/transport-blockhound-tests/src/test/resources/io/netty/util/internal/localhost_server.key
|
|
+++ /dev/null
|
|
@@ -1,28 +0,0 @@
|
|
------BEGIN PRIVATE KEY-----
|
|
-MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQDYrLtMlZzoe2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H3lA0i6R8Ly26FLSqw0Z12fx5GUUa1qaVRqo
|
|
-rwcrIZovbQKBgHa2mojs9AC+Sv3uvG1u9LuZKJ7jDaZqMI2R2d7xgOH0Op5Ohy6+
|
|
-39D1PVvasqroc3Op4J36rEcRVDHi2Uy+WJ/JNpO2+AhcXRuPodP88ZWel8C6aB+V
|
|
-zL/6oFntnAU5BgR5g2hLny2W0YbLsrMNmhDe15O0AvUo6cYla+K/pu/5AoGACr/g
|
|
-EdiMMcDthf+4DX0zjqpVBPq25J18oYdoPierOpjoJBIB8oqcJZfWxvi2t8+1zHA0
|
|
-xDGX7fZ8vwqEzJkIEaCTg/k4NqxaO+uq6pnJYoyFHMIB0aW1FQsNy3kTOC+MGqV5
|
|
-Ahoukf5VajA1MpX3L8upZO84qsmFu6yYhWLZB4kCgYBlgSD5G4q6rX4ELa3XG61h
|
|
-fDtu75IYEsjWm4vgJzHjeYT2xPIm9OFFYXjPghto0f1oH37ODD3DoXmsnmddgpmn
|
|
-tH7aRWWHsSpB5zVgftV4urNCIsm87LWw8mvUGgCwYV1CtCX8warKokfeoA2ltz4u
|
|
-oeuUzo98hN+aKRU5RO6Bmg==
|
|
------END PRIVATE KEY-----
|
|
diff --git a/transport-blockhound-tests/src/test/resources/io/netty/util/internal/localhost_server.pem b/transport-blockhound-tests/src/test/resources/io/netty/util/internal/localhost_server.pem
|
|
deleted file mode 100644
|
|
index 70759b29e5..0000000000
|
|
--- a/transport-blockhound-tests/src/test/resources/io/netty/util/internal/localhost_server.pem
|
|
+++ /dev/null
|
|
@@ -1,17 +0,0 @@
|
|
------BEGIN CERTIFICATE-----
|
|
-MIICozCCAYsCAnS/MA0GCSqGSIb3DQEBDQUAMBgxFjAUBgNVBAMTDU5ldHR5VGVz
|
|
-dFJvb3QwIBcNMTcwMjE3MDMzMzQ0WhgPMjExNzAxMjQwMzMzNDRaMBQxEjAQBgNV
|
|
-BAMTCWxvY2FsaG9zdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANis
|
|
-u0yVnOh7YE+IJREXdKjlc0t+w4twBURFdeOfGpfox7HnlZ0mLLq5ZMUptEdYl1tY
|
|
-Qt1nFWXn4Zeky/c52Qpm37X1l1J8HK/psHlE11k4Qaco4dJjZd2fNicXkkFpYTHR
|
|
-++28g9k5SVYNaCxDMmTVRCG75ecFzs/WEdg2/CxU05H4cP0sZ5sPL5Rx+IvfhfAD
|
|
-IF0dSxtwivyGW0AFyPq81uo4ud2lTzoPFT3P1vU8OaQVV+KwSWGkMSGnGZMLAjbZ
|
|
-SzUYLwPzUsxnMyVtZLNN808S6o3MlgaIW39c/A+Q8/JW+2LRdY8FCnDMkUVRfnEq
|
|
-w4YRGiUQtFPTI1BjOcUCAwEAATANBgkqhkiG9w0BAQ0FAAOCAQEAQNXnwE2MJFy5
|
|
-ti07xyi8h/mY0Kl1dwZUqx4F9D9eoxLCq2/p3h/Z18AlOmjdW06pvC2sGtQtyEqL
|
|
-YjuQFbMjXRo9c+6+d+xwdDKTu7+XOTHvznJ8xJpKnFOlohGq/n3efBIJSsaeasTU
|
|
-slFzmdKYABDZzbsQ4X6YCIOF4XVdEQqmXpS+uEbn5C2sVtG+LXI8srmkVGpCcRew
|
|
-SuTGanwxLparhBBeN1ARjKzNxXUWuK2UKZ9p8c7n7TXGhd12ZNTcLhk4rCnOFq1J
|
|
-ySFvP5YL2q29fpEt+Tq0zm3V7An2qtaNDp26cEdevtKPjRyOLkCJx8OlZxc9DZvJ
|
|
-HjalFDoRUw==
|
|
------END CERTIFICATE-----
|
|
diff --git a/transport-blockhound-tests/src/test/resources/io/netty/util/internal/mutual_auth_ca.pem b/transport-blockhound-tests/src/test/resources/io/netty/util/internal/mutual_auth_ca.pem
|
|
deleted file mode 100644
|
|
index 9c9241bc65..0000000000
|
|
--- a/transport-blockhound-tests/src/test/resources/io/netty/util/internal/mutual_auth_ca.pem
|
|
+++ /dev/null
|
|
@@ -1,19 +0,0 @@
|
|
------BEGIN CERTIFICATE-----
|
|
-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