Our codebase is going to have some unit tests using JAXRSServerFactoryBean. To be reliable, I not only have to ensure that I use a port number that is uncommon, I have to make sure that the other unit tests are using a different port.
Besides just using a plain random number generator in a range, are there any viable strategies for doing this? I thought about using "local transport" (https://cwiki.apache.org/confluence/display/CXF20DOC/JAXRS+Testing), which might solve this problem, but it appears that doing this requires at least a small change on the client side (setting DIRECT_DISPATCH on the request context), and I'm not sure our client interface is even compatible. We're using Client to get a WebTarget, and then an Invocation.Builder. Is it even possible to set this to use direct dispatch?
