Source:
private String getBrokerURLInstance() { if (getBrokerInstance() != null) { try { File xmlFile = new File(new File(getBrokerEtc()), "bootstrap.xml"); String configuration = xmlFile.toURI().toString().replace("file:", "xml:").replace("\\", "/"); BrokerDTO brokerDTO = BrokerFactory.createBrokerConfiguration(configuration, getBrokerHome(), getBrokerInstance(), getBrokerURIInstance()); FileConfiguration fileConfiguration = new FileConfiguration(); String serverConfiguration = brokerDTO.server.getConfigurationURI().toASCIIString(); FileDeploymentManager fileDeploymentManager = new FileDeploymentManager(serverConfiguration); fileDeploymentManager.addDeployable(fileConfiguration); fileDeploymentManager.readConfiguration(); for (TransportConfiguration acceptorConfiguration: fileConfiguration.getAcceptorConfigurations()) { Map<String, Object> acceptorParams = acceptorConfiguration.getParams(); String protocols = ConfigurationHelper.getStringProperty(TransportConstants.PROTOCOLS_PROP_NAME, null, acceptorParams).toUpperCase(); if (protocols == null || protocols.contains(protocol.toUpperCase())) { String scheme = ConfigurationHelper.getStringProperty(TransportConstants.SCHEME_PROP_NAME, SchemaConstants.TCP, acceptorParams); String host = ConfigurationHelper.getStringProperty(TransportConstants.HOST_PROP_NAME, "localhost", acceptorParams); int port = ConfigurationHelper.getIntProperty(TransportConstants.PORT_PROP_NAME, 61616, acceptorParams); if (scheme.equals(SchemaConstants.VM)) { host = ConfigurationHelper.getStringProperty("serverId", "0", acceptorParams); port = -1; } else if (InetAddress.getByName(host).isAnyLocalAddress()) { host = "localhost"; } return new URI(scheme, null, host, port, null, null, null).toString(); } } } catch (Exception e) { if (isVerbose()) { System.out.print("Can not get the broker url instance: " + e.toString()); } } } return null; }

Target:
private String getBrokerURLInstance() { if (getBrokerInstance() != null) { try { FileConfiguration fileConfiguration = new FileConfiguration(); String brokerConfiguration = new File(new File(getBrokerEtc()), "broker.xml").toURI().toASCIIString(); FileDeploymentManager fileDeploymentManager = new FileDeploymentManager(brokerConfiguration); fileDeploymentManager.addDeployable(fileConfiguration); fileDeploymentManager.readConfiguration(); for (TransportConfiguration acceptorConfiguration: fileConfiguration.getAcceptorConfigurations()) { if (acceptorConfiguration.getName().equals("artemis")) { Map<String, Object> acceptorParams = acceptorConfiguration.getParams(); String scheme = ConfigurationHelper.getStringProperty(TransportConstants.SCHEME_PROP_NAME, SchemaConstants.TCP, acceptorParams); String host = ConfigurationHelper.getStringProperty(TransportConstants.HOST_PROP_NAME, "localhost", acceptorParams); int port = ConfigurationHelper.getIntProperty(TransportConstants.PORT_PROP_NAME, 61616, acceptorParams); if (InetAddress.getByName(host).isAnyLocalAddress()) { host = "localhost"; } return new URI(scheme, null, host, port, null, null, null).toString(); } } } catch (Exception e) { if (isVerbose()) { System.out.print("Can not get the broker url instance: " + e.toString()); } } } return null; }