Package org.apache.mina.common

Examples of org.apache.mina.common.IoHandlerAdapter


        // can't use introspection to get Provider as it is a server class.
        // need to go straight to IoHandlerAdapter but that requries the queues and exchange from the ApplicationRegistry which we can't access.

        // get right constructor and pass in instancec ID - "port"
        IoHandlerAdapter provider;
        try
        {
            Class[] cnstr = {Integer.class};
            Object[] params = {port};
           
View Full Code Here


        synchronized (_inVmPipeAddress)
        {
            if (!_inVmPipeAddress.containsKey(port))
            {
                _logger.info("Creating InVM Qpid.AMQP listening on port " + port);
                IoHandlerAdapter provider = null;
                try
                {
                    VmPipeAddress pipe = new VmPipeAddress(port);

                    provider = createBrokerInstance(port);
View Full Code Here

        // can't use introspection to get Provider as it is a server class.
        // need to go straight to IoHandlerAdapter but that requries the queues and exchange from the ApplicationRegistry which we can't access.

        // get right constructor and pass in instancec ID - "port"
        IoHandlerAdapter provider;
        try
        {
            Class[] cnstr = {Integer.class};
            Object[] params = {port};
            provider = (IoHandlerAdapter) Class.forName(protocolProviderClass).getConstructor(cnstr).newInstance(params);
View Full Code Here

    
        IoConnector connector = new SocketConnector();
        IoSession[] sessions = new IoSession[ 5 ];
        for( int i = 0; i < sessions.length; i++ )
        {
            ConnectFuture future = connector.connect( new InetSocketAddress( "localhost", port ), new IoHandlerAdapter() );
            future.join();
            sessions[ i ] = future.getSession();
            Assert.assertTrue( sessions[ i ].isConnected() );
        }
       
View Full Code Here

    
        IoConnector connector = new VmPipeConnector();
        IoSession[] sessions = new IoSession[ 5 ];
        for( int i = 0; i < sessions.length; i++ )
        {
            ConnectFuture future = connector.connect( addr, new IoHandlerAdapter() );
            future.join();
            sessions[ i ] = future.getSession();
            Assert.assertTrue( sessions[ i ].isConnected() );
        }
       
View Full Code Here

* @author The Apache Directory Project (mina-dev@directory.apache.org)
* @version $Rev: 555855 $, $Date: 2007-07-13 12:19:00 +0900 (금, 13  72007) $
*/
public class IoAcceptorFactoryBeanTest extends TestCase {
    public void testBindUnbind() throws Exception {
        IoHandler handler1 = new IoHandlerAdapter();
        IoHandler handler2 = new IoHandlerAdapter();
        IoHandler handler3 = new IoHandlerAdapter();
        IoServiceConfig config1 = (IoServiceConfig) MockControl.createControl(
                IoServiceConfig.class).getMock();
        IoServiceConfig config2 = (IoServiceConfig) MockControl.createControl(
                IoServiceConfig.class).getMock();
        MockControl mockIoAcceptor = MockControl
View Full Code Here

        expectedConfig.getFilterChain().addLast("mock", mockFilter);
        acceptor.bind(new InetSocketAddress(port), mockHandler, expectedConfig);

        try {
            ConnectFuture future = connector.connect(new InetSocketAddress(
                    "localhost", port), new IoHandlerAdapter());
            future.join();

            WriteFuture writeFuture = future.getSession().write(
                    ByteBuffer.allocate(16).putInt(0).flip());
            writeFuture.join();
View Full Code Here

        IoConnector connector = new SocketConnector();
        IoSession[] sessions = new IoSession[5];
        for (int i = 0; i < sessions.length; i++) {
            ConnectFuture future = connector.connect(new InetSocketAddress(
                    "localhost", port), new IoHandlerAdapter());
            future.join();
            sessions[i] = future.getSession();
            Assert.assertTrue(sessions[i].isConnected());
        }
View Full Code Here

            // ignore
        }
    }

    public void testAnonymousBind() throws Exception {
        acceptor.bind(null, new IoHandlerAdapter());
        Assert.assertEquals(1, acceptor.getManagedServiceAddresses().size());
        acceptor.unbindAll();
        Thread.sleep(500);
        Assert.assertEquals(0, acceptor.getManagedServiceAddresses().size());

        acceptor.bind(createSocketAddress(0), new IoHandlerAdapter());
        Assert.assertEquals(1, acceptor.getManagedServiceAddresses().size());
        SocketAddress address = acceptor.getManagedServiceAddresses()
                .iterator().next();
        Assert.assertTrue(getPort(address) != 0);
        acceptor.unbind(address);
View Full Code Here

    protected abstract IoConnector createConnector();

    public void testConnectFutureSuccessTiming() throws Exception {
        int port = AvailablePortFinder.getNextAvailable(1025);
        IoAcceptor acceptor = createAcceptor();
        acceptor.bind(new InetSocketAddress(port), new IoHandlerAdapter());

        try {
            final StringBuffer buf = new StringBuffer();
            IoConnector connector = createConnector();
            ConnectFuture future = connector.connect(new InetSocketAddress(
                    "localhost", port), new IoHandlerAdapter() {
                public void sessionCreated(IoSession session) {
                    buf.append("1");
                }

                public void sessionOpened(IoSession session) {
View Full Code Here

TOP

Related Classes of org.apache.mina.common.IoHandlerAdapter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.