Uploaded image for project: 'Undertow'
  1. Undertow
  2. UNDERTOW-628

Allow server to find and use an open port

    XMLWordPrintable

Details

    • Feature Request
    • Resolution: Done
    • Critical
    • 1.4.0.Beta1, 2.0.0.Alpha1
    • 1.3.16.Final
    • Core
    • None

    Description

      I posted the following to the mailing list on February 9, 2016:

      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??

      Stuart Douglas replied: "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."

      Attachments

        Activity

          People

            sdouglas1@redhat.com Stuart Douglas
            oliverdain_jira Oliver Dain (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: