@Test
public void testServerInitializationFailure() throws Throwable {
expectedEx.expect(FlinkRuntimeException.class);
expectedEx.expectMessage("Unable to start Test Server 2. All ports in provided range are occupied.");
List<Integer> portList = new ArrayList<>();
portList.add(7777);
try (TestServer server1 = new TestServer("Test Server 1", new DisabledKvStateRequestStats(), portList.iterator())) {
server1.start();
try (TestServer server2 = new TestServer("Test Server 2", new DisabledKvStateRequestStats(),
Collections.singletonList(server1.getServerAddress().getPort()).iterator())) {
server2.start();
}
}
}