private int activeLocalPort0(@Nullable SessionProtocol protocol) {
        lock.lock();
        try {
            return activePorts.values().stream()
                              .filter(activePort -> (protocol == null || activePort.hasProtocol(protocol)) &&
                                                    isLocalPort(activePort))
                              .findFirst()
                              .orElseThrow(() -> new IllegalStateException(
                                      (protocol == null ? "no active local ports: "
                                                        : ("no active local ports for " + protocol + ": ")) +
                                      activePorts.values()))
                              .localAddress()
                              .getPort();
        } finally {
            lock.unlock();
        }
    }
Returns the local {@link ServerPort} which serves the given {@link SessionProtocol}.

@throws IllegalStateException if there is no active local port available for the given
                              {@link SessionProtocol} or the server is not started yet
core/src/main/java/com/linecorp/armeria/server/Server.java