private static int guessServerPort(SessionProtocol sessionProtocol, @Nullable String authority) {
        if (authority == null) {
            return sessionProtocol.defaultPort();
        }

        final int lastColonPos = authority.lastIndexOf(':');
        if (lastColonPos < 0) {
            return sessionProtocol.defaultPort();
        }

        final int port;
        try {
            port = Integer.parseInt(authority.substring(lastColonPos + 1));
        } catch (NumberFormatException e) {
            return sessionProtocol.defaultPort();
        }

        if (port <= 0 || port >= 65536) {
            return sessionProtocol.defaultPort();
        }

        return port;
    }
Sets the local socket address of the connection. If not set, it is auto-generated with the localhost
IP address (e.g. {@code "127.0.0.1"} or {@code "::1"}).
core/src/main/java/com/linecorp/armeria/common/AbstractRequestContextBuilder.java