Oracle GlassFish Message Queue 4.4.2 Developer's Guide for Java Clients

Creating a TCP Connection to an Embedded Broker

Once an embedded broker has been started, clients other than the one in which it is embedded can connect to it as though it were an ordinary standalone broker. For example:

com.sun.messaging.ConnectionFactory cf = new com.sun.messaging.ConnectionFactory();
cf.setProperty(ConnectionConfiguration.imqAddressList, "mq://");
Connection connection = cf.createConnection();