Package org.apache.mina.transport.socket.nio

Examples of org.apache.mina.transport.socket.nio.SocketAcceptor


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

        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


        ExecutorService acceptorPool = getCamelContext().getExecutorServiceManager().newCachedThreadPool(this, "MinaSocketAcceptor");
        ExecutorService connectorPool = getCamelContext().getExecutorServiceManager().newCachedThreadPool(this, "MinaSocketConnector");
        ExecutorService workerPool = getCamelContext().getExecutorServiceManager().newCachedThreadPool(this, "MinaThreadPool");

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

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

    public ReverserServer(int port) {
        this.port = port;
    }

    public void start() throws Exception {
        acceptor = new SocketAcceptor();

        // Prepare the configuration
        SocketAcceptorConfig cfg = new SocketAcceptorConfig();
        cfg.setReuseAddress(true);
        Charset charset = Charset.forName("UTF-8");
View Full Code Here

        ExecutorService acceptorPool = getCamelContext().getExecutorServiceManager().newCachedThreadPool(this, "MinaSocketAcceptor");
        ExecutorService connectorPool = getCamelContext().getExecutorServiceManager().newCachedThreadPool(this, "MinaSocketConnector");
        ExecutorService workerPool = getCamelContext().getExecutorServiceManager().newCachedThreadPool(this, "MinaThreadPool");

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

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

    @Test
    public void startAcceptor() throws IOException
    {
        IoAcceptor acceptor = null;
        acceptor = new SocketAcceptor();
       
        SocketAcceptorConfig config = (SocketAcceptorConfig) acceptor.getDefaultConfig();
        SocketSessionConfig sc = (SocketSessionConfig) config.getSessionConfig();
        sc.setTcpNoDelay(true);
        sc.setSendBufferSize(32768);
View Full Code Here

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

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

    private static final boolean USE_CUSTOM_CODEC = true;

    public static void main( String[] args ) throws Throwable
    {
        // Create ServiceRegistry.
        IoAcceptor acceptor = new SocketAcceptor();

        acceptor.bind(
                new InetSocketAddress( SERVER_PORT ),
                new ServerSessionHandler( USE_CUSTOM_CODEC ) );

        System.out.println( "Listening on port " + SERVER_PORT );
    }
View Full Code Here

    /** Set this to true if you want to make the server SSL */
    private static final boolean USE_SSL = false;

    public static void main( String[] args ) throws Exception
    {
        IoAcceptor acceptor = new SocketAcceptor();
        IoAcceptorConfig config = new SocketAcceptorConfig();
        DefaultIoFilterChainBuilder chain = config.getFilterChain();
       
        // Add SSL filter if SSL is enabled.
        if( USE_SSL )
        {
            addSSLSupport( chain  );
        }
       
        addLogger( chain );
       
        // Bind
        acceptor.bind(
                new InetSocketAddress( PORT ),
                new EchoProtocolHandler(),
                config );

        System.out.println( "Listening on port " + PORT );
View Full Code Here

        final SSLFilter sslFilter =
            new SSLFilter( BogusSSLContextFactory.getInstance( true ) );

        boundAddress = null;
        datagramAcceptor = new DatagramAcceptor();
        socketAcceptor = new SocketAcceptor();
       
        ( ( DatagramSessionConfig ) datagramAcceptor.getDefaultConfig().getSessionConfig() ).setReuseAddress( true );
        ( ( SocketAcceptorConfig ) socketAcceptor.getDefaultConfig() ).setReuseAddress( true );
       
View Full Code Here

{
    private static final int PORT = 8080;

    public static void main( String[] args ) throws Exception
    {
        IoAcceptor acceptor = new SocketAcceptor();

        // Bind
        acceptor.bind(
                new InetSocketAddress( PORT ),
                new ReverseProtocolHandler() );

        System.out.println( "Listening on port " + PORT );
    }
View Full Code Here

TOP

Related Classes of org.apache.mina.transport.socket.nio.SocketAcceptor

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.