Package org.apache.mina.filter

Examples of org.apache.mina.filter.SSLFilter$SSLFilterMessage


        if (_executorPool)
        {
            if (_sslFactory != null)
            {
                protocolSession.getFilterChain().addAfter("AsynchronousReadFilter", "sslFilter",
                        new SSLFilter(_sslFactory.buildServerContext()));
            }
        }
        else
        {
            if (_sslFactory != null)
            {
                protocolSession.getFilterChain().addBefore("protocolFilter", "sslFilter",
                        new SSLFilter(_sslFactory.buildServerContext()));
            }
        }
        // Do we want to have read/write buffer limits?
        if (_protectIO)
        {
View Full Code Here


                        factory.setKeyManagerFactoryKeyStore(keystoreMgmt.getKeyStore());
                        factory.setKeyManagerFactoryKeyStorePassword(keystorePassword);
                    }
                }
            }
            SSLFilter sslFilter = null;
            if (supportsTls) {
                sslFilter = new SSLFilter(factory.newInstance());
                sslFilter.setWantClientAuth(wantClientAuth);
                sslFilter.setNeedClientAuth(needClientAuth);
                sslFilter.setUseClientMode(!isServer);
                String[] cipherSuites = allowedCipherSuites == null || "".equals(allowedCipherSuites.trim()) ? null : allowedCipherSuites.split(",");
                if (cipherSuites != null) {
                    sslFilter.setEnabledCipherSuites(cipherSuites);
                }
            }

            CougarProtocol protocol;
            if (isServer) {
View Full Code Here

    }

    public void testTCPWithSSL() throws Exception
    {
        // Add an SSL filter
        SSLFilter sslFilter =
            new SSLFilter( BogusSSLContextFactory.getInstance( true ) );
        IoAcceptor acceptor = registry.getAcceptor( TransportType.SOCKET );
        acceptor.getFilterChain().addLast( "SSL", sslFilter );
       
        // Create a commons-net socket factory
        SSLSocketFactory.setSslEnabled(true);
View Full Code Here

    }
   
    public void testTCPWithSSL() throws Exception
    {
        // Add an SSL filter to acceptor
        SSLFilter acceptorSSLFilter =
            new SSLFilter( BogusSSLContextFactory.getInstance( true ) );
        IoAcceptor acceptor = registry.getAcceptor( TransportType.SOCKET );
        acceptor.getFilterChain().addLast( "SSL", acceptorSSLFilter );
       
        // Create a connector
        IoConnector connector = new SocketConnector();
       
        // Add an SSL filter to connector
        SSLFilter connectorSSLFilter =
            new SSLFilter( BogusSSLContextFactory.getInstance( false ) );
        connectorSSLFilter.setUseClientMode( true ); // set client mode
        connector.getFilterChain().addLast( "SSL", connectorSSLFilter );

        testConnector( connector );
    }
View Full Code Here

       
        // Run a basic connector test.
        testConnector0( session );
       
        // Send closeNotify to test TLS closure if it is TLS connection.
        SSLFilter sslf = ( SSLFilter ) connector.getFilterChain().get( "SSL" );
        if( sslf != null )
        {
            connector.getFilterChain().addFirst( "log", new LoggingFilter() );
            sslf.stopSSL( session ).join();
           
            System.out.println( "-------------------------------------------------------------------------------" );
            // Test again after we finished TLS session.
            testConnector0( session );
           
            System.out.println( "-------------------------------------------------------------------------------" );
           
            // Test if we can enter TLS mode again.
            //// Send StartTLS request.
            handler.readBuf.clear();
            ByteBuffer buf = ByteBuffer.allocate( 1 );
            buf.put( ( byte ) '.' );
            buf.flip();
            session.write( buf ).join();
           
            //// Wait for StartTLS response.
            waitForResponse( handler, 1 );

            handler.readBuf.flip();
            Assert.assertEquals( 1, handler.readBuf.remaining() );
            Assert.assertEquals( ( byte ) '.', handler.readBuf.get() );
           
            // Now start TLS connection
            Assert.assertTrue( sslf.startSSL( session ) );
            testConnector0( session );
            connector.getFilterChain().remove( "log" );
        }
       
        session.close().join();
View Full Code Here

    }

    private static void addSSLSupport( ServiceRegistry registry )
        throws Exception
    {
        SSLFilter sslFilter =
            new SSLFilter( BogusSSLContextFactory.getInstance( true ) );
        IoAcceptor acceptor = registry.getAcceptor( TransportType.SOCKET );
        acceptor.getFilterChain().addLast( "sslFilter", sslFilter );
        System.out.println( "SSL ON" );
    }
View Full Code Here

    private static void addSSLSupport( ServiceRegistry registry )
        throws Exception
    {
        System.out.println( "SSL is enabled." );
        SSLFilter sslFilter =
            new SSLFilter( BogusSSLContextFactory.getInstance( true ) );
        IoAcceptor acceptor = registry.getAcceptor( TransportType.SOCKET );
        acceptor.getFilterChain().addLast( "sslFilter", sslFilter );
    }
View Full Code Here

TOP

Related Classes of org.apache.mina.filter.SSLFilter$SSLFilterMessage

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.