Package org.apache.mina.common

Examples of org.apache.mina.common.IoHandlerAdapter


    
        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 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

        SocketAddress address;
        address = new InetSocketAddress(NetConstant.LOCALHOST_IP, NetShutdownHandlerCommand.DEFAULT_PORT);

        SocketConnectorConfig config = new SocketConnectorConfig();

        ConnectFuture future1 = connector.connect(address, new IoHandlerAdapter(), config);
        future1.join();
        if (!future1.isConnected()) {
            return;
        }
        IoSession session = future1.getSession();
View Full Code Here

* @author The Apache Directory Project (mina-dev@directory.apache.org)
* @version $Rev: 555855 $, $Date: 2007-07-13 05:19:00 +0200 (Fri, 13 Jul 2007) $
*/
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

*/
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.createControl( IoAcceptor.class );
View Full Code Here

    String processors = getProperty("pastrybroker.maxprocessors", "5");
    SocketConnector clientConnector = new SocketConnector(Integer
        .parseInt(processors), Executors.newCachedThreadPool());
    log.info("Connecting to local broker...");
    ConnectFuture connectFuture = clientConnector.connect(LOCAL_ADDRESS,
        new IoHandlerAdapter() {
          public void messageReceived(IoSession session, Object msg) {
            context = (PastryContext) msg;
            log.info("Pastry context retrieved");
          }
        }, connectorConfig);
View Full Code Here

                  .isConnected())
                  && brokerToClientSessions.size() < maxClientCount) {
                ConnectFuture cf = connector.connect(
                    new InetSocketAddress("127.0.0.1",
                        ipcPort),
                    new IoHandlerAdapter() {

                      public void sessionClosed(
                          IoSession session)
                          throws Exception {
                        // TODO Auto-generated method
View Full Code Here

        IoConnector connector = new VmPipeConnector();
        connector.getDefaultConfig().setThreadModel(ThreadModel.MANUAL);
        //connector.getFilterChain().addLast( "logger", new LoggingFilter() );

        acceptor.bind(new VmPipeAddress(1), new IoHandlerAdapter() {
            public void sessionOpened(IoSession session) throws Exception {
                session.write("B");
            }

            public void messageSent(IoSession session, Object message)
                    throws Exception {
                session.close();
            }
        });

        final StringBuffer actual = new StringBuffer();

        ConnectFuture future = connector.connect(new VmPipeAddress(1),
                new IoHandlerAdapter() {

                    public void messageReceived(IoSession session,
                            Object message) throws Exception {
                        actual.append(message);
                    }
View Full Code Here

        connector.getDefaultConfig().setThreadModel(ThreadModel.MANUAL);
        //connector.getFilterChain().addLast( "logger", new LoggingFilter() );

        final StringBuffer actual = new StringBuffer();

        acceptor.bind(new VmPipeAddress(1), new IoHandlerAdapter() {

            public void messageReceived(IoSession session, Object message)
                    throws Exception {
                actual.append(message);
            }

            public void sessionClosed(IoSession session) throws Exception {
                actual.append("C");
            }

            public void sessionOpened(IoSession session) throws Exception {
                actual.append("A");
            }

        });

        ConnectFuture future = connector.connect(new VmPipeAddress(1),
                new IoHandlerAdapter() {
                    public void sessionOpened(IoSession session)
                            throws Exception {
                        session.write("B");
                    }
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.