From 36cacc201e1c7a362358f7f6baa59cd8ece02df6 Mon Sep 17 00:00:00 2001 From: Norman Maurer Date: Fri, 19 Mar 2021 21:09:46 +0100 Subject: [PATCH] Don't bind to a specify port during SSLEngine tests as the port may also be used (#11102) Motivation: We should always bind to port 0 to ensure we not try to bind to a port that is already in use during our tests. As we missed to do this in one test we did see test failures sometimes. This showed up here: https://pipelines.actions.githubusercontent.com/obCqqsCMwwGme5y2aRyYOiZvWeJK4O0EY5AYRUDMSELILdqEjV/_apis/pipelines/1/runs/1963/signedlogcontent/18?urlExpires=2021-03-19T12%3A41%3A21.4370902Z&urlSigningMethod=HMACV1&urlSignature=zL6O0msEkghT%2B0hOAL1lqLK66SR0Mp99QIjiau1yPe4%3D Modifications: - Use new InetSocketAddress(0) Result: Fixes possible test failures. --- handler/src/test/java/io/netty/handler/ssl/SSLEngineTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/handler/src/test/java/io/netty/handler/ssl/SSLEngineTest.java b/handler/src/test/java/io/netty/handler/ssl/SSLEngineTest.java index 1f46d79215..cfe1fd9ec4 100644 --- a/handler/src/test/java/io/netty/handler/ssl/SSLEngineTest.java +++ b/handler/src/test/java/io/netty/handler/ssl/SSLEngineTest.java @@ -835,7 +835,7 @@ public abstract class SSLEngineTest { } }); - serverChannel = sb.bind(new InetSocketAddress(8443)).sync().channel(); + serverChannel = sb.bind(new InetSocketAddress(0)).sync().channel(); int port = ((InetSocketAddress) serverChannel.localAddress()).getPort(); ChannelFuture ccf = cb.connect(new InetSocketAddress(NetUtil.LOCALHOST, port));