Package org.apache.mina.common

Examples of org.apache.mina.common.DefaultIoFilterChainBuilder


    public MemoryMonitor() throws IOException {

        NioDatagramAcceptor acceptor = new NioDatagramAcceptor();
        acceptor.setHandler(new MemoryMonitorHandler(this));

        DefaultIoFilterChainBuilder chain = acceptor.getFilterChain();
        chain.addLast("logger", new LoggingFilter());

        DatagramSessionConfig dcfg = acceptor.getSessionConfig();
        dcfg.setReuseAddress(true);

        frame = new JFrame("Memory monitor");
View Full Code Here


        return filterChainBuilder;
    }

    public void setFilterChainBuilder(IoFilterChainBuilder builder) {
        if (builder == null) {
            builder = new DefaultIoFilterChainBuilder();
        }
        filterChainBuilder = builder;
    }
View Full Code Here

        return filterChainBuilder;
    }

    public void setFilterChainBuilder(IoFilterChainBuilder builder) {
        if (builder == null) {
            builder = new DefaultIoFilterChainBuilder();
        }
        filterChainBuilder = builder;
    }
View Full Code Here

        mockChain.replay();

        DefaultIoFilterChainBuilderFactoryBean factory = new DefaultIoFilterChainBuilderFactoryBean();
        factory.setFilters(Arrays.asList(filters));
        factory.setFilterNamePrefix("prefix");
        DefaultIoFilterChainBuilder builder = (DefaultIoFilterChainBuilder) factory
                .createInstance();
        builder.buildFilterChain(chain);

        mockChain.verify();
    }
View Full Code Here

        mockChain.replay();

        DefaultIoFilterChainBuilderFactoryBean factory = new DefaultIoFilterChainBuilderFactoryBean();
        factory.setFilters(mappings);
        DefaultIoFilterChainBuilder builder = (DefaultIoFilterChainBuilder) factory
                .createInstance();
        builder.buildFilterChain(chain);

        mockChain.verify();
    }
View Full Code Here

    }

    public void testCreateInstance() throws Exception
    {
       
        DefaultIoFilterChainBuilder builder1 = new DefaultIoFilterChainBuilder();
        builder1.addLast( "portFilter0", filter1 );
        DefaultIoFilterChainBuilder builder2 = new DefaultIoFilterChainBuilder();
        builder2.addLast( "portFilter0", filter1 );
        builder2.addLast( "portFilter1", filter2 );
       
        /*
         * Record expectations.
         */
        factory.createIoAcceptor();
        mockFactory.setReturnValue( ioAcceptor );
        ioAcceptor.setDisconnectClientsOnUnbind( true );
        factory.initIoService( ioAcceptor );
        ioAcceptor.bind( new DummySocketAddress( ":110" ), popHandler, builder1 );
        mockIoAcceptor.setMatcher( new IoAcceptorBindArgumentsMatcher() );
        ioAcceptor.bind( new DummySocketAddress( "127.0.0.1:22" ), sshHandler, builder2 );
        ioAcceptor.bind( new DummySocketAddress( "192.168.0.1:80" ),
                httpHandler, new DefaultIoFilterChainBuilder() );

        /*
         * Replay.
         */
        mockIoAcceptor.replay();
View Full Code Here

        protected boolean argumentMatches( Object expected, Object actual )
        {
            if( expected instanceof DefaultIoFilterChainBuilder &&
                actual instanceof DefaultIoFilterChainBuilder )
            {
                DefaultIoFilterChainBuilder b1 = ( DefaultIoFilterChainBuilder ) expected;
                DefaultIoFilterChainBuilder b2 = ( DefaultIoFilterChainBuilder ) actual;
               
                List l1 = b1.getAll();
                List l2 = b2.getAll();
                if( l1.size() != l2.size() )
                    return false;
               
                Iterator it1 = l1.iterator();
                Iterator it2 = l2.iterator();
View Full Code Here

                ( IoFilter ) MockControl.createControl( IoFilter.class )
                        .getMock() };

        IoService ioSessionManager =
            ( IoService ) mockIoService.getMock();
        DefaultIoFilterChainBuilder ioFilterChainBuilder =
            ( DefaultIoFilterChainBuilder ) mockIoFilterChainBuilder.getMock();

        /*
         * Record expectations.
         */
        ioFilterChainBuilder.addLast( "managerFilter0", filters[ 0 ] );
        ioFilterChainBuilder.addLast( "managerFilter1", filters[ 1 ] );
        ioFilterChainBuilder.addLast( "managerFilter2", filters[ 2 ] );

        ioSessionManager.getFilterChain();
        mockIoService.setReturnValue( mockIoFilterChainBuilder.getMock() );

        /*
 
View Full Code Here

                new IoFilterMapping( "third", ( IoFilter ) MockControl
                        .createControl( IoFilter.class ).getMock() ) };

        IoService ioSessionManager = ( IoService ) mockIoService
                .getMock();
        DefaultIoFilterChainBuilder ioFilterChainBuilder = ( DefaultIoFilterChainBuilder ) mockIoFilterChainBuilder
                .getMock();

        /*
         * Record expectations.
         */
        ioFilterChainBuilder.addLast( "first", mappings[ 0 ].getFilter() );
        ioFilterChainBuilder.addLast( "second", mappings[ 1 ].getFilter() );
        ioFilterChainBuilder.addLast( "third", mappings[ 2 ].getFilter() );

        ioSessionManager.getFilterChain();
        mockIoService.setReturnValue( mockIoFilterChainBuilder.getMock() );

        /*
 
View Full Code Here

        MockControl mockIoService = MockControl
                .createControl( IoService.class );

        IoService ioSessionManager = ( IoService ) mockIoService
                .getMock();
        DefaultIoFilterChainBuilder ioFilterChainBuilder = ( DefaultIoFilterChainBuilder ) MockClassControl
                .createControl( DefaultIoFilterChainBuilder.class ).getMock();

        /*
         * Record expectations.
         */
 
View Full Code Here

TOP

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

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.