public static ClusterResolver<EurekaEndpoint> fromURL(String regionName, URL serviceUrl) {
        boolean isSecure = "https".equalsIgnoreCase(serviceUrl.getProtocol());
        int defaultPort = isSecure ? 443 : 80;
        int port = serviceUrl.getPort() == -1 ? defaultPort : serviceUrl.getPort();

        return new StaticClusterResolver<EurekaEndpoint>(
                regionName,
                new DefaultEndpoint(serviceUrl.getHost(), port, isSecure, serviceUrl.getPath())
        );
    }
@Test
    public void testClusterResolverFromURL() throws Exception {
        verifyEqual(
                StaticClusterResolver.fromURL("regionA", new URL("http://eureka.test:8080/eureka/v2/apps")),
                new DefaultEndpoint("eureka.test", 8080, false, "/eureka/v2/apps")
        );
        verifyEqual(
                StaticClusterResolver.fromURL("regionA", new URL("https://eureka.test:8081/eureka/v2/apps")),
                new DefaultEndpoint("eureka.test", 8081, true, "/eureka/v2/apps")
        );
        verifyEqual(
                StaticClusterResolver.fromURL("regionA", new URL("http://eureka.test/eureka/v2/apps")),
                new DefaultEndpoint("eureka.test", 80, false, "/eureka/v2/apps")
        );
        verifyEqual(
                StaticClusterResolver.fromURL("regionA", new URL("https://eureka.test/eureka/v2/apps")),
                new DefaultEndpoint("eureka.test", 443, true, "/eureka/v2/apps")
        );
    }