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.
This commit is contained in:
Norman Maurer 2021-03-19 21:09:46 +01:00 committed by GitHub
parent aea9e381a7
commit 36cacc201e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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(); int port = ((InetSocketAddress) serverChannel.localAddress()).getPort();
ChannelFuture ccf = cb.connect(new InetSocketAddress(NetUtil.LOCALHOST, port)); ChannelFuture ccf = cb.connect(new InetSocketAddress(NetUtil.LOCALHOST, port));