@Test public void getNextAvailablePort_throws_ISE_if_too_many_attempts() { NetworkUtils.PortAllocator portAllocator = mock(NetworkUtils.PortAllocator.class); when(portAllocator.getAvailable(any(InetAddress.class))).thenReturn(900); expectedException.expect(IllegalStateException.class); expectedException.expectMessage("Fail to find an available port on "); getNextAvailablePort(getLoopbackAddress(), portAllocator); }
public static int getNextAvailablePort(InetAddress address) { return getNextAvailablePort(address, PortAllocator.INSTANCE); }
NetworkUtils { public static int getNextAvailablePort(InetAddress address) { return getNextAvailablePort(address, PortAllocator.INSTANCE); } }
NetworkUtils { public static int getNextAvailablePort(InetAddress address) { return getNextAvailablePort(address, PortAllocator.INSTANCE); } private  NetworkUtils(); }
NetworkUtils { public static int getNextAvailablePort(InetAddress address) { return getNextAvailablePort(address, PortAllocator.INSTANCE); } private  NetworkUtils(); static InetAddress getLocalhost(); static InetAddress getInetAddressByName(String name); static int getNextAvailablePort(InetAddress address); }
NetworkUtils { public static int getNextAvailablePort(InetAddress address) { return getNextAvailablePort(address, PortAllocator.INSTANCE); } private  NetworkUtils(); static InetAddress getLocalhost(); static InetAddress getInetAddressByName(String name); static int getNextAvailablePort(InetAddress address);  }