It may be worthwhile to use java.net.URI, but I'm not sure how much that saves us. We get correct URI handling for http:// and https://. Yay. What about esoteric helper protocols that aren't http or https?

For example, I have two schemes that are internal to google like google:// and some-thing-name:// that don't use an http or https style string after the :// part.

In this current code, I think escape(getPath()) isn't right. It converts "a/b%2Fc/d" to "a/b/c/d" which may be wrong for the remote system. We should be using the raw path here, and require callers who set a raw path to URL escape in UTF-8 on their own, or to use our setPath() method which will URL escape consistently but then does not permit this corner case of "a/b%2Fc/d".