I did some similiar stuff for the Javascript code, but I was able to hide the problem in the java code behind Javascript.
I'm not an expert on how hard it is to add a transport to the URL/Http universe in the JDK. I might take a look. The alternative is to grab the port by binding a socket, and then clean it up and use the number. Honestly, all the CXF tests just burn in some port numbers.
