<div dir="ltr">







<p class="p1">I&#39;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&#39;t see a method like getPort() on the Undertow object so I don&#39;t know how I&#39;d discover the port to which it bound. Is this possible??<br></p><p class="p1">Thanks,<br>Oliver</p></div><div dir="ltr">-- <br></div><div dir="ltr"><div style="font-size:small"><div style="font-size:13px;line-height:19.5px">CTO, Analytic Spot</div><div style="font-size:13px;line-height:19.5px">44 West Broadway #222</div><div style="font-size:13px;line-height:19.5px">Eugene, OR 97401<br></div><div style="font-size:13px;line-height:19.5px"><a href="http://analyticspot.com/" style="z-index: 0;">analyticspot.com</a> <span style="color:rgb(127,127,127);font-family:&#39;helvetica neue&#39;;font-size:11px;line-height:normal">• </span>425-296-6556</div></div><div style="font-size:small"><span style="line-height:19.5px"><a href="http://www.linkedin.com/in/oliverdain" style="z-index: 0;">www.linkedin.com/in/oliverdain</a></span></div></div>