public URLNormalizer removeDefaultPort() {
        URL u = toURL();
        if ("http".equalsIgnoreCase(u.getProtocol())
                && u.getPort() == HttpURL.DEFAULT_HTTP_PORT) {
            url = url.replaceFirst(":" + HttpURL.DEFAULT_HTTP_PORT, "");
        } else if ("https".equalsIgnoreCase(u.getProtocol())
                && u.getPort() == HttpURL.DEFAULT_HTTPS_PORT) {
            url = url.replaceFirst(":" + HttpURL.DEFAULT_HTTPS_PORT, "");
        }
        return this;
    }
@Test
    public void testRemoveDefaultPort() {
        s = "http://www.example.com:80/bar.html";
        t = "http://www.example.com/bar.html";
        assertEquals(t, n(s).removeDefaultPort().toString());
        s = "https://www.example.com:443/bar.html";
        t = "https://www.example.com/bar.html";
        assertEquals(t, n(s).removeDefaultPort().toString());
        s = "http://www.example.com/bar.html";
        t = "http://www.example.com/bar.html";
        assertEquals(t, n(s).removeDefaultPort().toString());
        s = "http://www.example.com:7080/bar.html";
        t = "http://www.example.com:7080/bar.html";
        assertEquals(t, n(s).removeDefaultPort().toString());
        s = "http://www.example.com:80";
        t = "http://www.example.com";
        assertEquals(t, n(s).removeDefaultPort().toString());
        s = "http://www.example.com";
        t = "http://www.example.com";
        assertEquals(t, n(s).removeDefaultPort().toString());
        s = "http://www.example.com/bar/:80";
        t = "http://www.example.com/bar/:80";
        assertEquals(t, n(s).removeDefaultPort().toString());
    }