Search in sources :

Example 1 with NettyAcceptorFactory

use of org.apache.activemq.artemis.core.remoting.impl.netty.NettyAcceptorFactory in project activemq-artemis by apache.

the class NettyAcceptorFactoryTest method testCreateAcceptor.

@Test
public void testCreateAcceptor() throws Exception {
    NettyAcceptorFactory factory = new NettyAcceptorFactory();
    Map<String, Object> params = new HashMap<>();
    BufferHandler handler = new BufferHandler() {

        @Override
        public void bufferReceived(final Object connectionID, final ActiveMQBuffer buffer) {
        }
    };
    ServerConnectionLifeCycleListener listener = new ServerConnectionLifeCycleListener() {

        @Override
        public void connectionException(final Object connectionID, final ActiveMQException me) {
        }

        @Override
        public void connectionDestroyed(final Object connectionID) {
        }

        @Override
        public void connectionCreated(ActiveMQComponent component, final Connection connection, final ProtocolManager protocol) {
        }

        @Override
        public void connectionReadyForWrites(Object connectionID, boolean ready) {
        }
    };
    Acceptor acceptor = factory.createAcceptor("netty", null, params, handler, listener, Executors.newCachedThreadPool(ActiveMQThreadFactory.defaultThreadFactory()), Executors.newScheduledThreadPool(ActiveMQDefaultConfiguration.getDefaultScheduledThreadPoolMaxSize(), ActiveMQThreadFactory.defaultThreadFactory()), new HashMap<String, ProtocolManager>());
    Assert.assertTrue(acceptor instanceof NettyAcceptor);
}
Also used : ActiveMQComponent(org.apache.activemq.artemis.core.server.ActiveMQComponent) NettyAcceptor(org.apache.activemq.artemis.core.remoting.impl.netty.NettyAcceptor) Acceptor(org.apache.activemq.artemis.spi.core.remoting.Acceptor) HashMap(java.util.HashMap) NettyAcceptor(org.apache.activemq.artemis.core.remoting.impl.netty.NettyAcceptor) Connection(org.apache.activemq.artemis.spi.core.remoting.Connection) NettyAcceptorFactory(org.apache.activemq.artemis.core.remoting.impl.netty.NettyAcceptorFactory) ServerConnectionLifeCycleListener(org.apache.activemq.artemis.spi.core.remoting.ServerConnectionLifeCycleListener) BufferHandler(org.apache.activemq.artemis.spi.core.remoting.BufferHandler) ActiveMQException(org.apache.activemq.artemis.api.core.ActiveMQException) ProtocolManager(org.apache.activemq.artemis.spi.core.protocol.ProtocolManager) ActiveMQBuffer(org.apache.activemq.artemis.api.core.ActiveMQBuffer) Test(org.junit.Test)

Aggregations

HashMap (java.util.HashMap)1 ActiveMQBuffer (org.apache.activemq.artemis.api.core.ActiveMQBuffer)1 ActiveMQException (org.apache.activemq.artemis.api.core.ActiveMQException)1 NettyAcceptor (org.apache.activemq.artemis.core.remoting.impl.netty.NettyAcceptor)1 NettyAcceptorFactory (org.apache.activemq.artemis.core.remoting.impl.netty.NettyAcceptorFactory)1 ActiveMQComponent (org.apache.activemq.artemis.core.server.ActiveMQComponent)1 ProtocolManager (org.apache.activemq.artemis.spi.core.protocol.ProtocolManager)1 Acceptor (org.apache.activemq.artemis.spi.core.remoting.Acceptor)1 BufferHandler (org.apache.activemq.artemis.spi.core.remoting.BufferHandler)1 Connection (org.apache.activemq.artemis.spi.core.remoting.Connection)1 ServerConnectionLifeCycleListener (org.apache.activemq.artemis.spi.core.remoting.ServerConnectionLifeCycleListener)1 Test (org.junit.Test)1