Are there any common libraries that will update the host and port for a given URL - I do not want to str replace the url string or construct a new URL for an already formed URL String I would like to replace the hostname and port.
If you meant to replace the host and port of a String that contains a URL (just an address), why don't you just replace the host and port with String replacements? Even if there exists a library/API, that must be doing the same behind the scene. If you meant to change the host/port of a java.net.URL object, the only possible way is creating your own URLStreamHandler, which is not a good idea at all. The best thing what you can do is constructing a new URL object. Moving to the sockets forum.