The embedded GF-integration uses the
bindHttpPort property in arquillian.xml to set the listener port for embedded GlassFish; the
setPort API method is used to this extent.
According to the embedded GlassFish Server Guide, the
setPort method must not be used in conjunction with the
setConfigFileURI API method calls.
We must conditionally invoke
setPort in such a scenario. Nevertheless, we'll require the user to provide the listener port in the
bindHttPort property of arquillian.xml. This will not be used to bind the embedded GF instance to the specified port; instead, it should match the listener port number in domain.xml. Embedded GF will use the value in domain.xml to bind itself to the port, and Arquillian would use the matching value in arquillian.xml to connect to the embedded instance at the correct port.