Java 类org.jboss.netty.channel.DefaultChannelPipeline 实例源码

项目:nfs-rpc    文件:NettyServer.java   
public void start(int listenPort, final ExecutorService threadPool) throws Exception {
  if (!startFlag.compareAndSet(false, true)) {
    return;
  }
  bootstrap.setPipelineFactory(new ChannelPipelineFactory() {
    public ChannelPipeline getPipeline() throws Exception {
      ChannelPipeline pipeline = new DefaultChannelPipeline();
      pipeline.addLast("decoder", new NettyProtocolDecoder());
      pipeline.addLast("encoder", new NettyProtocolEncoder());
      pipeline.addLast("handler", new NettyServerHandler(threadPool));
      return pipeline;
    }
  });
  bootstrap.bind(new InetSocketAddress(listenPort));
  LOGGER.warn("Server started,listen at: " + listenPort);
}
项目:graylog2-input-lumberjack    文件:LumberjackServer.java   
public void start() {
    bootstrap = new ServerBootstrap(new NioServerSocketChannelFactory(
            Executors.newFixedThreadPool(1),
            Executors.newCachedThreadPool()
    ));

    bootstrap.setPipelineFactory(new ChannelPipelineFactory() {
        public ChannelPipeline getPipeline() throws Exception {
            ChannelPipeline pipeline = new DefaultChannelPipeline();
            pipeline.addLast("ssl", new SslHandler(getSSLEngine()));
            pipeline.addLast("decoder", new LumberjackDecoder());
            pipeline.addLast("logHandler", new LogEventHandler(eventListener));
            return pipeline;
        }
    });
    bootstrap.bind(new InetSocketAddress(configuration.getIpAddress(), configuration.getPort()));
}
项目:graylog-beats-plugin    文件:LumberjackServer.java   
public void start() {
    bootstrap = new ServerBootstrap(new NioServerSocketChannelFactory(
            Executors.newFixedThreadPool(1),
            Executors.newCachedThreadPool()
    ));

    bootstrap.setPipelineFactory(new ChannelPipelineFactory() {
        public ChannelPipeline getPipeline() throws Exception {
            ChannelPipeline pipeline = new DefaultChannelPipeline();
            if(configuration.isSslEnabled()) {
                pipeline.addLast("ssl", new SslHandler(getSSLEngine()));
            }
            pipeline.addLast("decoder", new LumberjackDecoder());
            pipeline.addLast("logHandler", new EventHandler(eventListener));
            return pipeline;
        }
    });
    bootstrap.bind(new InetSocketAddress(configuration.getIpAddress(), configuration.getPort()));
}
项目:migration-tool    文件:NettyServer.java   
public void start(int listenPort, final ExecutorService threadPool, final long timeout) throws Exception {
    if (!startFlag.compareAndSet(false, true)) {
        return;
    }
    bootstrap.setPipelineFactory(new ChannelPipelineFactory() {
        public ChannelPipeline getPipeline() throws Exception {
            ChannelPipeline pipeline = new DefaultChannelPipeline();
            pipeline.addLast("decoder", new StringDecoder());
            pipeline.addLast("encoder", new StringEncoder());
            pipeline.addLast("handler", new NettyServerHandler(threadPool, timeout));
            return pipeline;
        }
    });
    bootstrap.bind(new InetSocketAddress(listenPort));
    log.warn("Server started,listen at: " + listenPort);
}
项目:nfs-rpc    文件:NettyClientPipelineFactory.java   
public ChannelPipeline getPipeline() throws Exception {
  ChannelPipeline pipeline = new DefaultChannelPipeline();
  pipeline.addLast("decoder", new NettyProtocolDecoder());
  pipeline.addLast("encoder", new NettyProtocolEncoder());
  pipeline.addLast("handler", handler);
  return pipeline;
}
项目:osrs-private-server    文件:PipelineFactory.java   
@Override
public ChannelPipeline getPipeline() throws Exception {
    final ChannelPipeline pipeline = new DefaultChannelPipeline();
    pipeline.addLast("timeout", new ReadTimeoutHandler(timer, 10));
    pipeline.addLast("encoder", new RS2Encoder());
    pipeline.addLast("decoder", new RS2LoginProtocol());
    pipeline.addLast("handler", new ChannelHandler());
    return pipeline;
}
项目:teiid    文件:ODBCSocketListener.java   
@Override
protected SSLAwareChannelHandler createChannelPipelineFactory(final SSLConfiguration config, final StorageManager storageManager) {
    return new SSLAwareChannelHandler(this, config, Thread.currentThread().getContextClassLoader(), storageManager) {
        @Override
        public ChannelPipeline getPipeline() throws Exception {
            ChannelPipeline pipeline = new DefaultChannelPipeline();
            PgBackendProtocol pgBackendProtocol = new PgBackendProtocol(maxLobSize, maxBufferSize, config, requireSecure);
            pipeline.addLast("odbcFrontendProtocol", new PgFrontendProtocol(pgBackendProtocol, 1 << 20)); //$NON-NLS-1$
            pipeline.addLast("odbcBackendProtocol", pgBackendProtocol); //$NON-NLS-1$
            pipeline.addLast("handler", this); //$NON-NLS-1$
            return pipeline;
        }           
    };
}
项目:migration-tool    文件:NettyClientPipelineFactory.java   
@Override
public ChannelPipeline getPipeline() throws Exception {
    ChannelPipeline pipeline = new DefaultChannelPipeline();
    pipeline.addLast("decoder", new StringDecoder());
    pipeline.addLast("encoder", new StringEncoder());
    pipeline.addLast("handler", handler);
    return pipeline;
}
项目:trap    文件:WebSocketServer.java   
public void run()
{
    // Configure the server.
    this.bootstrap = new ServerBootstrap(new NioServerSocketChannelFactory(Executors.newCachedThreadPool(), Executors.newCachedThreadPool()));

    // Set up the event pipeline factory.
    this.bootstrap.setPipelineFactory(new ChannelPipelineFactory() {

        @Override
        public ChannelPipeline getPipeline() throws Exception
        {
            WebServerSocketHandler webServerSocketHandler = new WebServerSocketHandler();
            ChannelPipeline pipeline = new DefaultChannelPipeline();
            pipeline.addLast("decoder", new HttpRequestDecoder());
            pipeline.addLast("aggregator", new HttpChunkAggregator(65536));
            pipeline.addLast("encoder", new HttpResponseEncoder());
            pipeline.addLast("handler", webServerSocketHandler);

            WebSocketServer.this.t.notifyAccept(webServerSocketHandler);

            return pipeline;
        }
    });

    // Bind and start to accept incoming connections.
    this.bind = this.bootstrap.bind(new InetSocketAddress(this.host, this.port));
    this.port = ((InetSocketAddress) this.bind.getLocalAddress()).getPort();

    System.out.println("Web socket server started at port " + this.port + '.');
    System.out.println("Open your browser and navigate to http://" + this.host + ":" + this.port + '/'); 
}
项目:creeper    文件:CreeperServerPipelineFactory.java   
public ChannelPipeline getPipeline() {
    ChannelPipeline pipeline = new DefaultChannelPipeline();
    pipeline.addLast("framer", new CreeperDelimiterBasedFrameDecoder(8192, Delimiters.lineDelimiter()));
    pipeline.addLast("decoder", new CreeperStringDecoder());
    pipeline.addLast("encoder", new StringEncoder());
    pipeline.addLast("handler", handler);
    return pipeline;
}
项目:jersey-netty    文件:ChunkedRequestAssemblerTest.java   
@Test
public void addChunkHandlesNonExistingChunkList() {
    DefaultLocalClientChannelFactory channelFactory = new DefaultLocalClientChannelFactory();
    DefaultChannelPipeline pipeline = new DefaultChannelPipeline();
    Channel channel = channelFactory.newChannel(pipeline);
    chunkedRequestAssembler.addChunk(channel, EMPTY_CHUNK);
}
项目:jersey-netty    文件:ChunkedRequestAssemblerTest.java   
@Test
public void addChunkHandlesNullChunk() {
    DefaultLocalClientChannelFactory channelFactory = new DefaultLocalClientChannelFactory();
    DefaultChannelPipeline pipeline = new DefaultChannelPipeline();
    Channel channel = channelFactory.newChannel(pipeline);
    chunkedRequestAssembler.addChunk(channel, null);
}
项目:jersey-netty    文件:ChunkedRequestAssemblerTest.java   
@Test
public void addChunkHandlesExistingChunkList() {
    DefaultLocalClientChannelFactory channelFactory = new DefaultLocalClientChannelFactory();
    DefaultChannelPipeline pipeline = new DefaultChannelPipeline();
    Channel channel = channelFactory.newChannel(pipeline);
    HttpRequest httpRequest = new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET, "");
    chunkedRequestAssembler.setup(channel, httpRequest);
    chunkedRequestAssembler.addChunk(channel, EMPTY_CHUNK);
}