This is not currently possible in an 'easy' manner. You could do it manually
(avoiding the Undertow object and using XNIO + the listeners directly and writing your own
code to handle this) however this is probably not what you are after. If you file a JIRA I
should be able to get this into the next Undertow version.
Stuart
----- Original Message -----
From: "Oliver Dain" <oliver(a)analyticspot.com>
To: undertow-dev(a)lists.jboss.org
Sent: Tuesday, 9 February, 2016 10:27:02 AM
Subject: [undertow-dev] Let undertow pick a port
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
_______________________________________________
undertow-dev mailing list
undertow-dev(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/undertow-dev