Github user zentol commented on a diff in the pull request: https://github.com/apache/flink/pull/5062#discussion_r153790032 --- Diff: flink-queryable-state/flink-queryable-state-runtime/src/test/java/org/apache/flink/queryablestate/network/AbstractServerTest.java --- @@ -60,23 +63,17 @@ public void testServerInitializationFailure() throws Throwable { expectedEx.expect(FlinkRuntimeException.class); expectedEx.expectMessage("Unable to start Test Server 2. All ports in provided range are occupied."); - TestServer server1 = null; - TestServer server2 = null; - try { + List<Integer> portList = new ArrayList<>(); + portList.add(7777); - server1 = startServer("Test Server 1", 7777); + try ( + TestServer server1 = new TestServer("Test Server 1", new DisabledKvStateRequestStats(), portList.iterator()); --- End diff -- a safer pattern is to give `server1` multiple ports to choose from and specifically start `server2` on the port `server1` eventually started with.
---