mirror of https://github.com/grpc/grpc-java.git
netty: NettyServerTest should not hard code ports (#3845)
This commit is contained in:
parent
8b716a2f18
commit
359e61eb4a
|
|
@ -118,8 +118,9 @@ public class NettyServerTest {
|
||||||
|
|
||||||
final CountDownLatch countDownLatch = new CountDownLatch(1);
|
final CountDownLatch countDownLatch = new CountDownLatch(1);
|
||||||
|
|
||||||
|
InetSocketAddress addr = new InetSocketAddress(0);
|
||||||
NettyServer ns = new NettyServer(
|
NettyServer ns = new NettyServer(
|
||||||
new InetSocketAddress(9999),
|
addr,
|
||||||
NioServerSocketChannel.class,
|
NioServerSocketChannel.class,
|
||||||
channelOptions,
|
channelOptions,
|
||||||
null, // no boss group
|
null, // no boss group
|
||||||
|
|
@ -154,7 +155,7 @@ public class NettyServerTest {
|
||||||
});
|
});
|
||||||
|
|
||||||
Socket socket = new Socket();
|
Socket socket = new Socket();
|
||||||
socket.connect(new InetSocketAddress("localhost", 9999), 8000);
|
socket.connect(new InetSocketAddress("localhost", ns.getPort()), /* timeout= */ 8000);
|
||||||
countDownLatch.await();
|
countDownLatch.await();
|
||||||
socket.close();
|
socket.close();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue