protected final URL getUrl(String path, Param... param) {
        final StringBuilder url = new StringBuilder()
            .append(getProtocol())
            .append("://")
            .append(host);

        if (port > 0) {
            url.append(":").append(port);
        }

        url.append("/").append(path);

        if (param.length > 0) {
            url.append(
                Stream.of(param)
                    .map(p ->
                        encode(p.getKey()) +
                        "=" +
                        encode(p.getValue())
                    )
                    .collect(joining("&", "?", ""))
            );
        }

        final String urlStr = url.toString();
        try {
            return new URL(urlStr);
        } catch (final MalformedURLException ex) {
            throw new IllegalArgumentException(String.format(
                "Error building URL: '%s'.", urlStr
            ), ex);
        }
    }
Default implementation of the {@link Rest}-interface.

@author  Emil Forslund
@since   1.0.0
common-parent/rest/src/main/java/com/speedment/common/rest/RestImpl.java