public URI advertisedUrl() {
        UriBuilder builder = UriBuilder.fromUri(jettyServer.getURI());

        String advertisedSecurityProtocol = determineAdvertisedProtocol();
        ServerConnector serverConnector = findConnector(advertisedSecurityProtocol);
        builder.scheme(advertisedSecurityProtocol);

        String advertisedHostname = config.advertisedHostName();
        if (advertisedHostname != null && !advertisedHostname.isEmpty())
            builder.host(advertisedHostname);
        else if (serverConnector != null && serverConnector.getHost() != null && !serverConnector.getHost().isEmpty())
            builder.host(serverConnector.getHost());

        Integer advertisedPort = config.advertisedPort();
        if (advertisedPort != null)
            builder.port(advertisedPort);
        else if (serverConnector != null && serverConnector.getPort() > 0)
            builder.port(serverConnector.getPort());
        else if (serverConnector != null && serverConnector.getLocalPort() > 0)
            builder.port(serverConnector.getLocalPort());

        log.info("Advertised URI: {}", builder.build());

        return builder.build();
    }
Get the URL to advertise to other workers and clients. This uses the default connector from the embedded Jetty
server, unless overrides for advertised hostname and/or port are provided via configs. {@link #initializeServer()}
must be invoked successfully before calling this method.
connect/runtime/src/main/java/org/apache/kafka/connect/runtime/rest/RestServer.java