Examples of IoConnector


Examples of com.yz.net.expand.IoConnector

      Configure config = new Configure();
      config.setAddress(new InetSocketAddress("127.0.0.1",8899));
      config.setProtocolHandler(new Protocol());
      config.setIoHandler(new DataHandler());
     
      IoConnector connector = new IoConnector();
     
      config.start(connector);
     
      /*Thread t = new Thread(printRspTime);
      t.start();*/
 
View Full Code Here

Examples of com.yz.net.expand.IoConnector

  public static IoConnector connector = null;
 
  public static void main(String[] args) {
    try {
      //新建一个连接器
      connector = new IoConnector();
     
      Configure config = new Configure();
      config.setAddress(new InetSocketAddress("127.0.0.1", 8899));
      config.setProtocolHandler(new EchoProtocol());
      config.setIoHandler(new EchoHandler());
View Full Code Here

Examples of org.apache.mina.common.IoConnector

    public void testConnectorActivation() throws Exception {
        IoServiceListenerSupport support = new IoServiceListenerSupport();

        MockControl connectorControl = MockControl
                .createStrictControl(IoConnector.class);
        IoConnector connector = (IoConnector) connectorControl.getMock();

        final TestSession session = new TestSession(connector, ADDRESS);

        MockControl chainControl = MockControl
                .createStrictControl(IoFilterChain.class);
View Full Code Here

Examples of org.apache.mina.common.IoConnector

    {
        IoAcceptor acceptor = new SocketAcceptor();
        ( ( SocketAcceptorConfig ) acceptor.getDefaultConfig() ).setReuseAddress( true );
        SocketAddress address = new InetSocketAddress( "localhost", AvailablePortFinder.getNextAvailable() );

        IoConnector connector = new SocketConnector();
       
        FixedRandomInputStream stream = new FixedRandomInputStream( 4 * 1024 * 1024 );
       
        SenderHandler sender = new SenderHandler( stream );
        ReceiverHandler receiver = new ReceiverHandler( stream.size );
       
        acceptor.bind( address, sender );
       
        synchronized( sender.lock )
        {
            synchronized( receiver.lock )
            {
                connector.connect( address, receiver );
               
                sender.lock.wait();
                receiver.lock.wait();
            }
        }
View Full Code Here

Examples of org.apache.mina.common.IoConnector

    /**
     * {@inheritDoc}
     */
    public Connector<SocketAddress> createConnector() {
        IoConnector minaConnector;
        if (transportType.equals(TransportType.RELIABLE)) {
            minaConnector =
                new org.apache.mina.transport.socket.nio.SocketConnector(
                    numProcessors, executor);
        } else {
View Full Code Here

Examples of org.apache.mina.common.IoConnector

    }

    protected MinaEndpoint createVmEndpoint(String uri, URI connectUri) {
        IoAcceptor acceptor = new VmPipeAcceptor();
        SocketAddress address = new VmPipeAddress(connectUri.getPort());
        IoConnector connector = new VmPipeConnector();
        return new MinaEndpoint(uri, this, address, acceptor, connector, null);
    }
View Full Code Here

Examples of org.apache.mina.common.IoConnector

    }

    protected MinaEndpoint createSocketEndpoint(String uri, URI connectUri) {
        IoAcceptor acceptor = new SocketAcceptor();
        SocketAddress address = new InetSocketAddress(connectUri.getHost(), connectUri.getPort());
        IoConnector connector = new SocketConnector();

        // TODO customize the config via URI
        SocketConnectorConfig config = new SocketConnectorConfig();
        config.getFilterChain().addLast("codec", new ProtocolCodecFilter(new ObjectSerializationCodecFactory()));
View Full Code Here

Examples of org.apache.mina.common.IoConnector

    }

    protected MinaEndpoint createDatagramEndpoint(String uri, URI connectUri) {
        IoAcceptor acceptor = new DatagramAcceptor();
        SocketAddress address = new InetSocketAddress(connectUri.getHost(), connectUri.getPort());
        IoConnector connector = new DatagramConnector();

        // TODO customize the config via URI
        DatagramConnectorConfig config = new DatagramConnectorConfig();
        config.getFilterChain().addLast("codec", new ProtocolCodecFilter(new ObjectSerializationCodecFactory()));
View Full Code Here

Examples of org.apache.mina.common.IoConnector

    }

    @Override
    protected void doStart() throws Exception {
        SocketAddress address = endpoint.getAddress();
        IoConnector connector = endpoint.getConnector();
        if (LOG.isDebugEnabled()) {
            LOG.debug("Creating connector to address: " + address + " using connector: " + connector);
        }
        IoHandler ioHandler = new IoHandlerAdapter() {
            @Override
            public void messageReceived(IoSession ioSession, Object object) throws Exception {
                super.messageReceived(ioSession, object);
                /** TODO */
            }
        };
        ConnectFuture future = connector.connect(address, ioHandler, endpoint.getConfig());
        future.join();
        session = future.getSession();
    }
View Full Code Here

Examples of org.apache.mina.common.IoConnector

    //-------------------------------------------------------------------------

    protected MinaEndpoint createVmEndpoint(String uri, URI connectUri) {
        IoAcceptor acceptor = new VmPipeAcceptor();
        SocketAddress address = new VmPipeAddress(connectUri.getPort());
        IoConnector connector = new VmPipeConnector();
        return new MinaEndpoint(uri, this, address, acceptor, null, connector, null, false, 0, false, false);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.