Search in sources :

Example 1 with NetworkConnector

use of org.apache.activemq.network.NetworkConnector in project tomee by apache.

the class ActiveMQ5FactoryTest method duplex.

@Test
public void duplex() throws Exception {
    final int port = getNextAvailablePort();
    for (final boolean b : asList(true, false)) {
        // broker:(tcp://localhost:${port})?networkConnectorURIs=static%3A%2F%2Ftcp%3A%2F%2Flocalhost%3A${port}%3Fduplex%3Dtrue
        final URI brokerURI = new URI("amq5factory:broker:(tcp://localhost:" + port + ")?" + "networkConnectorURIs=" + URLEncoder.encode("static://tcp://localhost:" + port + "?duplex=" + b, "UTF-8"));
        final BrokerService bs = new ActiveMQ5Factory().createBroker(brokerURI);
        bs.stop();
        ActiveMQ5Factory.brokers.remove(brokerURI);
        final NetworkConnector nc = bs.getNetworkConnectors().iterator().next();
        assertEquals("duplex is " + b, b, nc.isDuplex());
    }
}
Also used : NetworkConnector(org.apache.activemq.network.NetworkConnector) URI(java.net.URI) BrokerService(org.apache.activemq.broker.BrokerService) Test(org.junit.Test)

Aggregations

URI (java.net.URI)1 BrokerService (org.apache.activemq.broker.BrokerService)1 NetworkConnector (org.apache.activemq.network.NetworkConnector)1 Test (org.junit.Test)1