Package org.apache.mina.common

Examples of org.apache.mina.common.IoAcceptor


        long timeout = configuration.getTimeout();
        boolean sync = configuration.isSync();
        List<IoFilter> filters = configuration.getFilters();
        final int processorCount = Runtime.getRuntime().availableProcessors() + 1;

        IoAcceptor acceptor = new SocketAcceptor(processorCount,
                getCamelContext().getExecutorServiceStrategy().newDefaultThreadPool(this, "MinaSocketAcceptor"));
        IoConnector connector = new SocketConnector(processorCount,
                getCamelContext().getExecutorServiceStrategy().newDefaultThreadPool(this, "MinaSocketConnector"));
        SocketAddress address = new InetSocketAddress(configuration.getHost(), configuration.getPort());
View Full Code Here


        long timeout = configuration.getTimeout();
        boolean transferExchange = configuration.isTransferExchange();
        boolean sync = configuration.isSync();
        List<IoFilter> filters = configuration.getFilters();

        IoAcceptor acceptor = new DatagramAcceptor(getCamelContext().getExecutorServiceStrategy().newDefaultThreadPool(this, "MinaDatagramAcceptor"));
        IoConnector connector = new DatagramConnector(getCamelContext().getExecutorServiceStrategy().newDefaultThreadPool(this, "MinaDatagramConnector"));
        SocketAddress address = new InetSocketAddress(configuration.getHost(), configuration.getPort());

        if (transferExchange) {
            throw new IllegalArgumentException("transferExchange=true is not supported for datagram protocol");
View Full Code Here

    protected MinaEndpoint createVmEndpoint(String uri, MinaConfiguration configuration) {
        boolean minaLogger = configuration.isMinaLogger();
        boolean sync = configuration.isSync();

        IoAcceptor acceptor = new VmPipeAcceptor();
        SocketAddress address = new VmPipeAddress(configuration.getPort());
        IoConnector connector = new VmPipeConnector();

        // connector config
        configureCodecFactory("MinaProducer", connector.getDefaultConfig(), configuration);
        if (minaLogger) {
            connector.getFilterChain().addLast("logger", new LoggingFilter());
        }

        // acceptor connectorConfig
        configureCodecFactory("MinaConsumer", acceptor.getDefaultConfig(), configuration);
        if (minaLogger) {
            acceptor.getFilterChain().addLast("logger", new LoggingFilter());
        }

        MinaEndpoint endpoint = new MinaEndpoint(uri, this);
        endpoint.setAddress(address);
        endpoint.setAcceptor(acceptor);
View Full Code Here

    protected MinaEndpoint createSocketEndpoint(String uri, MinaConfiguration configuration) {
        boolean minaLogger = configuration.isMinaLogger();
        long timeout = configuration.getTimeout();
        boolean sync = configuration.isSync();

        IoAcceptor acceptor = new SocketAcceptor();
        SocketAddress address = new InetSocketAddress(configuration.getHost(), configuration.getPort());
        IoConnector connector = new SocketConnector();

        // connector config
        SocketConnectorConfig connectorConfig = new SocketConnectorConfig();
View Full Code Here

        boolean minaLogger = configuration.isMinaLogger();
        long timeout = configuration.getTimeout();
        boolean transferExchange = configuration.isTransferExchange();
        boolean sync = configuration.isSync();

        IoAcceptor acceptor = new DatagramAcceptor();
        SocketAddress address = new InetSocketAddress(configuration.getHost(), configuration.getPort());
        IoConnector connector = new DatagramConnector();

        if (transferExchange) {
            throw new IllegalArgumentException("transferExchange=true is not supported for datagram protocol");
View Full Code Here

        // protocol not resolved so error
        throw new IllegalArgumentException("Unrecognised MINA protocol: " + protocol + " for uri: " + uri);
    }

    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);
    }
View Full Code Here

        IoConnector connector = new VmPipeConnector();
        return new MinaEndpoint(uri, this, address, acceptor, null, connector, null, false, 0, false);
    }

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

        boolean lazySessionCreation = ObjectConverter.toBool(parameters.get("lazySessionCreation"));
        long timeout = getTimeoutParameter(parameters);
View Full Code Here

        addCodecFactory(config, codecFactory);
    }

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

        boolean lazySessionCreation = ObjectConverter.toBool(parameters.get("lazySessionCreation"));
        long timeout = getTimeoutParameter(parameters);
View Full Code Here

        IoServiceConfig config1 =
            ( IoServiceConfig ) MockControl.createControl( IoServiceConfig.class ).getMock();
        IoServiceConfig config2 =
            ( IoServiceConfig ) MockControl.createControl( IoServiceConfig.class ).getMock();
        MockControl mockIoAcceptor = MockControl.createControl( IoAcceptor.class );
        IoAcceptor acceptor = ( IoAcceptor ) mockIoAcceptor.getMock();
       
        acceptor.bind( new InetSocketAddress( 80 ), handler1, config1 );
        acceptor.bind( new InetSocketAddress( "192.168.0.1", 22 ), handler2, config2 );
        acceptor.bind( new InetSocketAddress( "10.0.0.1", 9876 ), handler3 );
        acceptor.unbind( new InetSocketAddress( 80 ) );
        acceptor.unbind( new InetSocketAddress( "192.168.0.1", 22 ) );
        acceptor.unbind( new InetSocketAddress( "10.0.0.1", 9876 ) );
       
        mockIoAcceptor.replay();
       
        IoAcceptorFactoryBean factory = new IoAcceptorFactoryBean();
        factory.setTarget( acceptor );
View Full Code Here

        assertEquals( IoAcceptor.class, new IoAcceptorFactoryBean().getObjectType() );
    }
   
    public void testGetObject() throws Exception
    {
        IoAcceptor acceptor =
            ( IoAcceptor ) MockControl.createControl( IoAcceptor.class ).getMock();
        IoAcceptorFactoryBean factory = new IoAcceptorFactoryBean();
        factory.setTarget( acceptor );

        assertEquals( acceptor, factory.getObject() );
View Full Code Here

TOP

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

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.