@Override
    protected URI getOrigin(final Path container, final Distribution.Method method) {
        final URI url = URI.create(String.format("%s%s", new DefaultWebUrlProvider().toUrl(origin).getUrl(), PathNormalizer.normalize(origin.getDefaultPath(), true)));
        if(log.isDebugEnabled()) {
            log.debug(String.format("Use origin %s for distribution %s", url, method));
        }
        return url;
    }
@Test
    public void testGetOriginCustomHttpsPort() {
        final Host origin = new Host(new TestProtocol(), "m");
        final Path container = new Path("/", EnumSet.of(Path.Type.directory, Path.Type.volume));
        origin.setWebURL("https://w.example.net:4444");
        final CustomOriginCloudFrontDistributionConfiguration configuration
            = new CustomOriginCloudFrontDistributionConfiguration(origin, new DefaultX509TrustManager(), new DefaultX509KeyManager());
        assertEquals("w.example.net", configuration.getOrigin(container, Distribution.CUSTOM).getHost());
        assertEquals("https", configuration.getOrigin(container, Distribution.CUSTOM).getScheme());
        assertEquals(4444, configuration.getOrigin(container, Distribution.CUSTOM).getPort());
        origin.setWebURL(null);
        assertEquals("m", configuration.getOrigin(container, Distribution.CUSTOM).getHost());
        assertEquals(-1, configuration.getOrigin(container, Distribution.CUSTOM).getPort());
    }