public Host get(final String url) throws HostParserException {
        final StringReader reader = new StringReader(url);
        final Protocol parsedProtocol, protocol;
        if((parsedProtocol = findProtocol(reader, factory)) != null) {
            protocol = parsedProtocol;
        }
        else {
            protocol = defaultScheme;
        }
        final Consumer<HostParserException> parsedProtocolDecorator = e -> e.withProtocol(parsedProtocol);
        final Host host = new Host(protocol);
        final URITypes uriType = findURIType(reader);
        if(uriType == URITypes.Undefined) {
            // scheme:
            if(StringUtils.isBlank(protocol.getDefaultHostname())) {
                throw decorate(new HostParserException(String.format("Missing hostname in URI %s", url)), parsedProtocolDecorator);
            }
            return host;
        }

        if(uriType == URITypes.Authority) {
            if(host.getProtocol().isHostnameConfigurable()) {
                parseAuthority(reader, host, parsedProtocolDecorator);
            }
            else {
                parseRootless(reader, host, parsedProtocolDecorator);
            }
        }
        else if(uriType == URITypes.Rootless) {
            parseRootless(reader, host, parsedProtocolDecorator);
        }
        else if(uriType == URITypes.Absolute) {
            parseAbsolute(reader, host, parsedProtocolDecorator);
        }
        if(log.isDebugEnabled()) {
            log.debug(String.format("Parsed %s as %s", url, host));
        }
        return host;
    }
@Test
    public void parseDefaultHostnameWithUserRelativePath() throws Exception {
        final Host host = new HostParser(new ProtocolFactory(Collections.singleton(new TestProtocol(Scheme.https) {
            @Override
            public String getDefaultHostname() {
                return "defaultHostname";
            }

            @Override
            public boolean isHostnameConfigurable() {
                return false;
            }
        }))).get("https://user@folder/file");
        assertEquals("defaultHostname", host.getHostname());
        assertEquals("user", host.getCredentials().getUsername());
        assertEquals("folder/file", host.getDefaultPath());
    }