When doing an http upgrade, remoting tries to resolve hostname constructing URI. But if user has specified IP address to the remote endpoint that has a wrong reverse DNS entry, then the resulting URL would be wrong.
I observed this on windows running wildfly testsuite with such IP. Because windows resolves back local IPs with wrong reverse entries to the computer name. I think it makes more sense to obey user choice if user has specified an IP address instead of a hostname.
So this is my proposed solution to the problem and I have tested that it helps with wildfly in the said environment:
I'll make a pull request in a minute.