<div dir="ltr">Hi,<div>For what it&#39;s worth, we had the same issue. We worked around it by opening a server socket ourselves, check the port that it grabbed and immediately closing the socket and then assign that port to Undertow. This is very unlikely to go into a race, as the kernel always assigns incrementing port numbers. It&#39;s a bit of a hack, but works for us.<br></div><div><br></div><div>Friso</div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Nov 30, 2016 at 10:24 PM, Stuart Douglas <span dir="ltr">&lt;<a href="mailto:sdouglas@redhat.com" target="_blank">sdouglas@redhat.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">We don&#39;t support this at the moment, but it would be something that is<br>
nice to have.<br>
<br>
Stuart<br>
<br>
On Wed, Nov 30, 2016 at 12:03 AM, Sascha Sadat-Guscheh &lt;<a href="mailto:kid@bitkid.com">kid@bitkid.com</a>&gt; wrote:<br>
&gt; hello undertow developers!<br>
&gt;<br>
&gt; is there a way to start a http listener on a random free port? i have a test suite that runs multithreaded so each untertow server uses a random port, that i get like this:<br>
&gt;<br>
&gt; new ServerSocket(0).getLocalPort()<br>
&gt;<br>
&gt; sometimes i run into a race condition when a different process grabs the port before undertow listens on it.  so a possible solution would be to just let undertow assign the port, and then ask it what port its listening on. (or pass the socket instead of the port number to undertow)<br>
&gt;<br>
&gt; is that a worthwile feature? should i try to submit a pr that does that? or is it already possible?<br>
&gt;<br>
&gt; thanks!<br>
&gt;<br>
&gt; ______________________________<wbr>_________________<br>
&gt; undertow-dev mailing list<br>
&gt; <a href="mailto:undertow-dev@lists.jboss.org">undertow-dev@lists.jboss.org</a><br>
&gt; <a href="https://lists.jboss.org/mailman/listinfo/undertow-dev" rel="noreferrer" target="_blank">https://lists.jboss.org/<wbr>mailman/listinfo/undertow-dev</a><br>
<br>
______________________________<wbr>_________________<br>
undertow-dev mailing list<br>
<a href="mailto:undertow-dev@lists.jboss.org">undertow-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/undertow-dev" rel="noreferrer" target="_blank">https://lists.jboss.org/<wbr>mailman/listinfo/undertow-dev</a><br>
</blockquote></div><br></div></div>