@Test public void findOpenPort_should_not_return_zero() throws IOException { assertThat(NetUtils.findOpenPort()) .isGreaterThan(0) .isLessThanOrEqualTo(65535); }
public static int findOpenPort() throws IOException { try (ServerSocket socket = new ServerSocket(0)) { return socket.getLocalPort(); } }
NetUtils { public static int findOpenPort() throws IOException { try (ServerSocket socket = new ServerSocket(0)) { return socket.getLocalPort(); } } }
NetUtils { public static int findOpenPort() throws IOException { try (ServerSocket socket = new ServerSocket(0)) { return socket.getLocalPort(); } } private  NetUtils(); }
NetUtils { public static int findOpenPort() throws IOException { try (ServerSocket socket = new ServerSocket(0)) { return socket.getLocalPort(); } } private  NetUtils(); static int findOpenPort(); }
NetUtils { public static int findOpenPort() throws IOException { try (ServerSocket socket = new ServerSocket(0)) { return socket.getLocalPort(); } } private  NetUtils(); static int findOpenPort();  }