Search in sources :

Example 11 with Connection

use of org.apache.activemq.artemis.spi.core.remoting.Connection 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

Connection (org.apache.activemq.artemis.spi.core.remoting.Connection)11 ActiveMQException (org.apache.activemq.artemis.api.core.ActiveMQException)4 RemotingConnection (org.apache.activemq.artemis.spi.core.protocol.RemotingConnection)4 ActiveMQBuffer (org.apache.activemq.artemis.api.core.ActiveMQBuffer)3 CoreRemotingConnection (org.apache.activemq.artemis.core.protocol.core.CoreRemotingConnection)3 HashMap (java.util.HashMap)2 SimpleString (org.apache.activemq.artemis.api.core.SimpleString)2 NettyAcceptor (org.apache.activemq.artemis.core.remoting.impl.netty.NettyAcceptor)2 NettyConnection (org.apache.activemq.artemis.core.remoting.impl.netty.NettyConnection)2 ActiveMQComponent (org.apache.activemq.artemis.core.server.ActiveMQComponent)2 ClusterConnection (org.apache.activemq.artemis.core.server.cluster.ClusterConnection)2 Notification (org.apache.activemq.artemis.core.server.management.Notification)2 ProtocolManager (org.apache.activemq.artemis.spi.core.protocol.ProtocolManager)2 BufferHandler (org.apache.activemq.artemis.spi.core.remoting.BufferHandler)2 ServerConnectionLifeCycleListener (org.apache.activemq.artemis.spi.core.remoting.ServerConnectionLifeCycleListener)2 TypedProperties (org.apache.activemq.artemis.utils.collections.TypedProperties)2 Test (org.junit.Test)2 Channel (io.netty.channel.Channel)1 ChannelHandler (io.netty.channel.ChannelHandler)1 ServerChannel (io.netty.channel.ServerChannel)1