Language: Java
Label: safe
CWE: NVD-CWE-noinfo \u2014 

Code:
    public void init() throws Exception {
        httpPort = server.activePorts()
                         .values()
                         .stream()
                         .filter(ServerPort::hasHttp)
                         .findAny()
                         .get()
                         .localAddress()
                         .getPort();
    }