@Override
    public String toString() {
        StringBuilder b = new StringBuilder();
        if (StringUtils.isNotBlank(protocol)) {
            b.append(protocol);
            b.append("://");
        }
        if (StringUtils.isNotBlank(host)) {
            b.append(host);
        }
        if (!isPortDefault() && port != -1) {
            b.append(':');
            b.append(port);
        }
        if (StringUtils.isNotBlank(path)) {
            // If no scheme/host/port, leave the path as is
            if (b.length() > 0 && !path.startsWith("/")) {
                b.append('/');
            }
            b.append(encodePath(path));
        }
        if (queryString != null && !queryString.isEmpty()) {
            b.append(queryString.toString());
        }
        if (fragment != null) {
            b.append("#");
            b.append(encodePath(fragment));
        }

        return b.toString();
    }
@Test
    public void testNullOrBlankURLs() {
        s = null;
        t = "";
        assertEquals(t, new HttpURL(s).toString());
        s = "";
        t = "";
        assertEquals(t, new HttpURL(s).toString());
        s = "  ";
        t = "";
        assertEquals(t, new HttpURL(s).toString());
    }