I'm trying to write some unit tests with an embedded undertow server. I’d like to have the server find an open port. This makes the tests more robust in many ways. For example, tests can be run in parallel and if a socket is held in CLOSE_WAIT or something from a previous test the next test will still run and succeed. With most servers I’ve used you can pass 0 for the port and the server will find an open port. This doesn’t seem to be the case with Undertow. Even if that would work, I don't see a method like getPort() on the Undertow object so I don't know how I'd discover the port to which it bound. Is this possible??

Thanks,
Oliver

--
CTO, Analytic Spot
44 West Broadway #222
Eugene, OR 97401
analyticspot.com • 425-296-6556
www.linkedin.com/in/oliverdain