Search in sources :

Example 1 with ActivationFailureListener

use of org.apache.activemq.artemis.core.server.ActivationFailureListener in project activemq-artemis by apache.

the class ActivationFailureListenerTest method simpleTest.

@Test
public void simpleTest() throws Exception {
    Socket s = new Socket();
    try {
        s.bind(new InetSocketAddress("127.0.0.1", 61616));
        server = createServer(false, createDefaultNettyConfig());
        final CountDownLatch latch = new CountDownLatch(1);
        server.registerActivationFailureListener(new ActivationFailureListener() {

            @Override
            public void activationFailed(Exception exception) {
                latch.countDown();
            }
        });
        server.start();
        assertTrue(latch.await(3000, TimeUnit.MILLISECONDS));
    } finally {
        s.close();
    }
}
Also used : ActivationFailureListener(org.apache.activemq.artemis.core.server.ActivationFailureListener) InetSocketAddress(java.net.InetSocketAddress) CountDownLatch(java.util.concurrent.CountDownLatch) Socket(java.net.Socket) Test(org.junit.Test)

Aggregations

InetSocketAddress (java.net.InetSocketAddress)1 Socket (java.net.Socket)1 CountDownLatch (java.util.concurrent.CountDownLatch)1 ActivationFailureListener (org.apache.activemq.artemis.core.server.ActivationFailureListener)1 Test (org.junit.Test)1