From 359e61eb4ae0f15263d3e3037b24da4b0fe15268 Mon Sep 17 00:00:00 2001 From: zpencer Date: Thu, 7 Dec 2017 10:53:28 -0800 Subject: [PATCH] netty: NettyServerTest should not hard code ports (#3845) --- netty/src/test/java/io/grpc/netty/NettyServerTest.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/netty/src/test/java/io/grpc/netty/NettyServerTest.java b/netty/src/test/java/io/grpc/netty/NettyServerTest.java index 0a46c822bd..a984f71a3a 100644 --- a/netty/src/test/java/io/grpc/netty/NettyServerTest.java +++ b/netty/src/test/java/io/grpc/netty/NettyServerTest.java @@ -118,8 +118,9 @@ public class NettyServerTest { final CountDownLatch countDownLatch = new CountDownLatch(1); + InetSocketAddress addr = new InetSocketAddress(0); NettyServer ns = new NettyServer( - new InetSocketAddress(9999), + addr, NioServerSocketChannel.class, channelOptions, null, // no boss group @@ -154,7 +155,7 @@ public class NettyServerTest { }); Socket socket = new Socket(); - socket.connect(new InetSocketAddress("localhost", 9999), 8000); + socket.connect(new InetSocketAddress("localhost", ns.getPort()), /* timeout= */ 8000); countDownLatch.await(); socket.close();