Examples of SocketAcceptor


Examples of org.apache.directory.server.protocol.shared.SocketAcceptor

        else
        {
            LOG.info( "server: using default settings ..." );
            DirectoryService directoryService = new DefaultDirectoryService();
            directoryService.startup();
            SocketAcceptor socketAcceptor = new SocketAcceptor( null );
            LdapServer ldapServer = new LdapServer();
            ldapServer.setSocketAcceptor( socketAcceptor );
            ldapServer.setDirectoryService( directoryService );
            ldapServer.start();
            LdapServer ldapsServer = new LdapServer();
View Full Code Here

Examples of org.apache.mina.io.socket.SocketAcceptor

        registry = new SimpleServiceRegistry();

        try {
            Service service = new Service(SERVICE_NAME, TransportType.SOCKET, port);
            registry.bind(service, httpIOHandler);
            SocketAcceptor acceptor = (SocketAcceptor) registry.getIoAcceptor(TransportType.SOCKET);
            configureFilters(acceptor);
            acceptor.setExceptionMonitor(new LoggingExceptionMonitor());
            LOG.info("NIO HTTP Transport bound on port " + port);
        } catch (IOException e) {
            throw new TransportException("NIOTransport Failed to bind to port " + port, e);
        }
    }
View Full Code Here

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

            config.setBothIdleTime(SO_IDLETIME);
            config.setWriteTimeout(SO_WRITE_TIMEOUT);
            config.setBroadcast(false);
            return datagramAcceptor;
        } else {
            final SocketAcceptor acceptor;
            if("APRSOCKET".equals(CONN_TYPE)) {
                LOG.info("AprSocketAcceptor is used for RemotePaging");
                acceptor = new AprSocketAcceptor(NUM_IO_PROCESSORS);
            } else {
                LOG.info("NioSocketAcceptor is used for RemotePaging");
                acceptor = new NioSocketAcceptor(NUM_IO_PROCESSORS);
            }
            SocketSessionConfig config = acceptor.getSessionConfig();
            config.setReuseAddress(true);
            config.setReadBufferSize(1024);
            config.setSendBufferSize(SND_BUFSIZE);
            config.setBothIdleTime(SO_IDLETIME);
            config.setWriteTimeout(SO_WRITE_TIMEOUT);
View Full Code Here

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

        chainBuilders.add( chainBuilder );

        try
        {
            SocketAcceptor acceptor = getSocketAcceptor( transport );

            // Now, configure the acceptor
            // Disable the disconnection of the clients on unbind
            acceptor.setCloseOnDeactivation( false );

            // No Nagle's algorithm
            acceptor.getSessionConfig().setTcpNoDelay( true );

            // Inject the chain
            acceptor.setFilterChainBuilder( chainBuilder );

            // Inject the protocol handler
            acceptor.setHandler( getHandler() );

            ( ( AbstractSocketSessionConfig ) acceptor.getSessionConfig() ).setReadBufferSize( 64 * 1024 );
            ( ( AbstractSocketSessionConfig ) acceptor.getSessionConfig() ).setSendBufferSize( 64 * 1024 );

            // Bind to the configured address
            acceptor.bind();

            // We are done !
            started = true;

            if ( LOG.isInfoEnabled() )
View Full Code Here

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

    /** 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 {
        SocketAcceptor acceptor = new NioSocketAcceptor();
        acceptor.setReuseAddress( true );
        DefaultIoFilterChainBuilder chain = acceptor.getFilterChain();
       
        // Add SSL filter if SSL is enabled.
        if (USE_SSL) {
            addSSLSupport(chain);
        }

        // Bind
        acceptor.setHandler(new EchoProtocolHandler());
        acceptor.bind(new InetSocketAddress(PORT));

        System.out.println("Listening on port " + PORT);
       
        for (;;) {
            System.out.println("R: " + acceptor.getStatistics().getReadBytesThroughput() +
                ", W: " + acceptor.getStatistics().getWrittenBytesThroughput());
            Thread.sleep(3000);
        }
    }
View Full Code Here

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

                }, "authContext")).setIgnoreUnhandledEvents(true).setIgnoreStateContextLookupFailure(true).create(
                IoFilter.class, sm);
    }
   
    public static void main(String[] args) throws Exception {
        SocketAcceptor acceptor = new NioSocketAcceptor();
        acceptor.setReuseAddress(true);
        ProtocolCodecFilter pcf = new ProtocolCodecFilter(
                new TextLineEncoder(), new CommandDecoder());
        acceptor.getFilterChain().addLast("log1", new LoggingFilter("log1"));
        acceptor.getFilterChain().addLast("codec", pcf);
//        acceptor.getFilterChain().addLast("authentication", createAuthenticationIoFilter());
        acceptor.getFilterChain().addLast("log2", new LoggingFilter("log2"));
        acceptor.setHandler(createIoHandler());
        acceptor.bind(new InetSocketAddress(PORT));
    }
View Full Code Here

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

        nexus.registerSupportedSaslMechanisms( saslMechanismHandlers.keySet() );

        try
        {
            SocketAcceptor acceptor = getSocketAcceptor( transport );
           
            // Now, configure the acceptor
            // Disable the disconnection of the clients on unbind
            acceptor.setCloseOnDeactivation( false );
           
            // Allow the port to be reused even if the socket is in TIME_WAIT state
            acceptor.setReuseAddress( true );
           
            // No Nagle's algorithm
            acceptor.getSessionConfig().setTcpNoDelay( true );
           
            // Inject the chain
            acceptor.setFilterChainBuilder( chainBuilder );
           
            // Inject the protocol handler
            acceptor.setHandler( getHandler() );
           
            // Bind to the configured address
            acceptor.bind();
           
            // We are done !
            started = true;

            if ( LOG.isInfoEnabled() )
View Full Code Here

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

    /** 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 {
        SocketAcceptor acceptor = new NioSocketAcceptor();
        DefaultIoFilterChainBuilder chain = acceptor.getFilterChain();
       
        // Add SSL filter if SSL is enabled.
        if (USE_SSL) {
            addSSLSupport(chain);
        }

        // Bind
        acceptor.setHandler(new EchoProtocolHandler());
        acceptor.bind(new InetSocketAddress(PORT));

        System.out.println("Listening on port " + PORT);
       
        for (;;) {
            System.out.println("R: " + acceptor.getStatistics().getReadBytesThroughput() +
                ", W: " + acceptor.getStatistics().getWrittenBytesThroughput());
            Thread.sleep(3000);
        }
    }
View Full Code Here

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

        chainBuilders.add( chainBuilder );

        try
        {
            SocketAcceptor acceptor = getSocketAcceptor( transport );

            // Now, configure the acceptor
            // Disable the disconnection of the clients on unbind
            acceptor.setCloseOnDeactivation( false );

            // No Nagle's algorithm
            acceptor.getSessionConfig().setTcpNoDelay( true );

            // Inject the chain
            acceptor.setFilterChainBuilder( chainBuilder );

            // Inject the protocol handler
            acceptor.setHandler( getHandler() );

            ( ( AbstractSocketSessionConfig ) acceptor.getSessionConfig() ).setReadBufferSize( 64 * 1024 );
            ( ( AbstractSocketSessionConfig ) acceptor.getSessionConfig() ).setSendBufferSize( 64 * 1024 );

            // Bind to the configured address
            acceptor.bind();

            // We are done !
            started = true;

            if ( LOG.isInfoEnabled() )
View Full Code Here

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

        nexus.registerSupportedSaslMechanisms( saslMechanismHandlers.keySet() );

        try
        {
            SocketAcceptor acceptor = getSocketAcceptor( transport );
           
            // Now, configure the acceptor
            // Disable the disconnection of the clients on unbind
            acceptor.setCloseOnDeactivation( false );
           
            // Allow the port to be reused even if the socket is in TIME_WAIT state
            acceptor.setReuseAddress( true );
           
            // No Nagle's algorithm
            acceptor.getSessionConfig().setTcpNoDelay( true );
           
            // Inject the chain
            acceptor.setFilterChainBuilder( chainBuilder );
           
            // Inject the protocol handler
            acceptor.setHandler( getHandler() );
           
            // Bind to the configured address
            acceptor.bind();
           
            // We are done !
            started = true;

            if ( LOG.isInfoEnabled() )
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.