Skip to content

Commit f8afc80

Browse files
committed
Use netty-pkitesting for self-signed certs
1 parent ef53ff3 commit f8afc80

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

client/pom.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,13 @@
180180
<scope>test</scope>
181181
</dependency>
182182

183+
<dependency>
184+
<groupId>io.netty</groupId>
185+
<artifactId>netty-pkitesting</artifactId>
186+
<version>${netty.version}</version>
187+
<scope>test</scope>
188+
</dependency>
189+
183190
<!-- Testcontainers for Docker-based integration tests -->
184191
<dependency>
185192
<groupId>org.testcontainers</groupId>

client/src/test/java/org/asynchttpclient/BasicHttp2Test.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@
4545
import io.netty.handler.ssl.ApplicationProtocolNames;
4646
import io.netty.handler.ssl.SslContext;
4747
import io.netty.handler.ssl.SslContextBuilder;
48-
import io.netty.handler.ssl.util.SelfSignedCertificate;
48+
import io.netty.pkitesting.CertificateBuilder;
49+
import io.netty.pkitesting.X509Bundle;
4950
import io.netty.util.concurrent.GlobalEventExecutor;
5051
import org.asynchttpclient.test.EventCollectingHandler;
5152
import org.junit.jupiter.api.AfterEach;
@@ -335,9 +336,11 @@ public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
335336

336337
@BeforeEach
337338
public void startServer() throws Exception {
338-
SelfSignedCertificate ssc = new SelfSignedCertificate();
339+
X509Bundle bundle = new CertificateBuilder()
340+
.subject("CN=localhost")
341+
.buildSelfSigned();
339342

340-
serverSslCtx = SslContextBuilder.forServer(ssc.certificate(), ssc.privateKey())
343+
serverSslCtx = SslContextBuilder.forServer(bundle.toKeyManagerFactory())
341344
.applicationProtocolConfig(new ApplicationProtocolConfig(
342345
ApplicationProtocolConfig.Protocol.ALPN,
343346
ApplicationProtocolConfig.SelectorFailureBehavior.NO_ADVERTISE,

0 commit comments

Comments
 (0)