public URI uri(SessionProtocol protocol, SerializationFormat format) {
        requireNonNull(protocol, "protocol");
        requireNonNull(format, "format");

        ensureStarted();

        final int port;
        if (!protocol.isTls() && hasHttp()) {
            port = httpPort();
        } else if (protocol.isTls() && hasHttps()) {
            port = httpsPort();
        } else {
            throw new IllegalStateException("can't find the specified port");
        }

        final String uriStr = protocol.uriText() + "://127.0.0.1:" + port;
        if (format == SerializationFormat.NONE) {
            return URI.create(uriStr);
        } else {
            return URI.create(format.uriText() + '+' + uriStr);
        }
    }
Returns the {@link URI} for the {@link Server} of the specified {@link SessionProtocol} and
{@link SerializationFormat}.

@throws IllegalStateException if the {@link Server} is not started or
                              it did not open the port for the specified {@link SessionProtocol}.
junit5/src/main/java/com/linecorp/armeria/internal/testing/ServerRuleDelegate.java