Package org.apache.mina.filter.codec

Examples of org.apache.mina.filter.codec.ProtocolCodecFilter


        IoAcceptor accepter = setupAcceptor();
        accepter.setHandler(new IOHandler());

        DefaultIoFilterChainBuilder filterChainBuilder = accepter.getFilterChain();
        // Add CPU-bound job first,
        ProtocolCodecFilter protocolFiler = new ProtocolCodecFilter(new ResponseEncoder(), new RequestDecoder());
        filterChainBuilder.addLast("protocol", protocolFiler);
        // and then a thread pool. REVIEWME
        filterChainBuilder.addLast("execFilter", new ExecutorFilter(ExecutorFactory.newCachedThreadPool("execFilter")));

        InetAddress host = InetAddress.getLocalHost();
View Full Code Here


            }
   
            acceptor.getFilterChain().addLast("threadPool",
                    new ExecutorFilter(context.getThreadPoolExecutor()));
            acceptor.getFilterChain().addLast("codec",
                    new ProtocolCodecFilter(new FtpServerProtocolCodecFactory()));
            acceptor.getFilterChain().addLast("mdcFilter2", mdcFilter);
            acceptor.getFilterChain().addLast("logger", new FtpLoggingFilter());
   
            if (isImplicitSsl()) {
                SslConfiguration ssl = getSslConfiguration();
View Full Code Here

        acceptor = new NioSocketAcceptor();

        acceptor.getFilterChain().addLast( "logger",
                                           new LoggingFilter() );
        acceptor.getFilterChain().addLast( "codec",
                                           new ProtocolCodecFilter( new ObjectSerializationCodecFactory() ) );

        acceptor.setHandler( handler );
        acceptor.getSessionConfig().setReadBufferSize( 2048 );
        acceptor.getSessionConfig().setIdleTime( IdleStatus.BOTH_IDLE, 10 );
        acceptor.bind( new InetSocketAddress( localInterface, port ) );
View Full Code Here

           
            //connector.setHandler( arg0 );
           
            connector.getFilterChain().addLast(
                                               "codec",
                                               new ProtocolCodecFilter(
                                                       new ObjectSerializationCodecFactory()));

            ConnectFuture future1 = connector.connect( address );
            future1.join();
            if (!future1.isConnected()) {
View Full Code Here

        acceptor = new NioSocketAcceptor();

//        cfg.getFilterChain().addLast("mimemessage1", new MimeMessageIOFilter() );
        acceptor.getFilterChain().addLast("logger", new LoggingFilter());
        acceptor.getFilterChain().addLast("codec", new ProtocolCodecFilter(new TextLineCodecFactory(Charset.forName("US-ASCII"))));
        acceptor.getFilterChain().addLast("stream", new StreamWriteFilter() );
        acceptor.setHandler( new PopIOHandlerAdapter(this) );
        try {
            //cfg.getFilterChain().addLast("codec", new ProtocolCodecFilter(new TextLineCodecFactory(Charset.forName("UTF-8"))));
            acceptor.bind(new InetSocketAddress(popPort));
View Full Code Here

      log.debug("Default Send Buffer Size "+connector.getSessionConfig().getSendBufferSize());
     
      connector.getSessionConfig().setSendBufferSize(8192*8);
      connector.getSessionConfig().setTcpNoDelay(true);
     
      connector.getFilterChain().addLast("codec", new ProtocolCodecFilter(new ClientDesktopCodecSharingFactory()));
     
      //StreamWriteFilter.setWriteBufferSize
      //connector.getSessionConfig().set
     
      log.debug("Setting the handler");
View Full Code Here

  public void doInitSocket() {
    try {
     
      acceptor = new NioSocketAcceptor();
     
      acceptor.getFilterChain().addLast("protocol", new ProtocolCodecFilter(new ServerDesktopCodecSharingFactory()));
     
      acceptor.getSessionConfig().setMinReadBufferSize(65535);
      acceptor.getSessionConfig().setMaxReadBufferSize(65535);
      acceptor.getSessionConfig().setReadBufferSize(65535);
      acceptor.getSessionConfig().setReceiveBufferSize(65535);
View Full Code Here

    List threadsBefore = getThreadNames();

    final IoAcceptor acceptor = new NioSocketAcceptor();

    acceptor.getFilterChain().addLast( "logger", new LoggingFilter() );
    acceptor.getFilterChain().addLast( "codec", new ProtocolCodecFilter( new TextLineCodecFactory( Charset.forName( "UTF-8" ))));

    acceptor.setHandlernew ServerHandler() );

    acceptor.getSessionConfig().setReadBufferSize( 2048 );
    acceptor.getSessionConfig().setIdleTime( IdleStatus.BOTH_IDLE, 10 );
    acceptor.bind( new InetSocketAddress(PORT) );
    System.out.println("Server running ...");

    final NioSocketConnector connector = new NioSocketConnector();

    // Set connect timeout.
    connector.setConnectTimeoutMillis(30 * 1000L);

    connector.setHandler(new ClientHandler());
    connector.getFilterChain().addLast( "logger", new LoggingFilter() );
    connector.getFilterChain().addLast( "codec", new ProtocolCodecFilter( new TextLineCodecFactory( Charset.forName( "UTF-8" ))));

    // Start communication.
    ConnectFuture cf = connector.connect(new InetSocketAddress("localhost", 9123));
    cf.awaitUninterruptibly();

View Full Code Here

    public MTalkConnector(NotificationListener notificationListener) {
  this.notificationListener = notificationListener;
  connector = new NioSocketConnector();
  connector.setHandler(this);
  connector.getFilterChain().addLast("codec", new ProtocolCodecFilter(new GSFCodecFactory()));
  connector.getFilterChain().addFirst("sslfilter", getSSLFilter());
    }
View Full Code Here

  public static void main(String[] args) throws IOException
  {
    ImageServerIoHandler handler = new ImageServerIoHandler();
    SocketAcceptor acceptor = new SocketAcceptor();
    acceptor.getFilterChain().addLast("protocol", new ProtocolCodecFilter(new ImageCodecFactory(false)));
    acceptor.bind(new InetSocketAddress(PORT), handler);
    System.out.println("server is listenig at port " + PORT);
  }
View Full Code Here

TOP

Related Classes of org.apache.mina.filter.codec.ProtocolCodecFilter

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.