public static int findFreePort()

in src/main/java/org/apache/sling/testing/paxexam/TestSupport.java [147:153]


    public static int findFreePort() {
        try (ServerSocket serverSocket = new ServerSocket(0)) {
            return serverSocket.getLocalPort();
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }