ARTEMIS-4174: test is verifying hostname detail, so use floating ports to avoid sporadic bind failures that are happening

This commit is contained in:
Robbie Gemmell 2023-09-06 16:31:42 +01:00
parent aa4e4409bf
commit 9864e005d2
2 changed files with 3 additions and 3 deletions

View File

@ -63,7 +63,7 @@ public class RmiRegistryFactory {
* Create a server socket for testing purposes. * Create a server socket for testing purposes.
*/ */
ServerSocket createTestSocket() throws IOException { ServerSocket createTestSocket() throws IOException {
return socketFactory.createServerSocket(1100); return socketFactory.createServerSocket(0);
} }
public Object getObject() throws Exception { public Object getObject() throws Exception {

View File

@ -31,7 +31,7 @@ public class JMXRMIRegistryPortTest extends ActiveMQTestBase {
public void explicitLocalhostRegistry() throws IOException { public void explicitLocalhostRegistry() throws IOException {
RmiRegistryFactory registryFactory = new RmiRegistryFactory(); RmiRegistryFactory registryFactory = new RmiRegistryFactory();
registryFactory.setHost("localhost"); registryFactory.setHost("localhost");
registryFactory.setPort(1099); registryFactory.setPort(0);
registryFactory.init(); registryFactory.init();
runAfter(registryFactory::destroy); runAfter(registryFactory::destroy);
try (ServerSocket testSocket = registryFactory.createTestSocket()) { try (ServerSocket testSocket = registryFactory.createTestSocket()) {
@ -43,7 +43,7 @@ public class JMXRMIRegistryPortTest extends ActiveMQTestBase {
public void unlimitedHostRegistry() throws IOException { public void unlimitedHostRegistry() throws IOException {
RmiRegistryFactory registryFactory = new RmiRegistryFactory(); RmiRegistryFactory registryFactory = new RmiRegistryFactory();
registryFactory.setHost(null); registryFactory.setHost(null);
registryFactory.setPort(1099); registryFactory.setPort(0);
registryFactory.init(); registryFactory.init();
runAfter(registryFactory::destroy); runAfter(registryFactory::destroy);
try (ServerSocket testSocket = registryFactory.createTestSocket()) { try (ServerSocket testSocket = registryFactory.createTestSocket()) {