Search in sources :

Example 36 with ChannelPipeline

use of org.jboss.netty.channel.ChannelPipeline in project databus by linkedin.

the class DummyHttpRequestHandler method setupClient.

private void setupClient() {
    _clientBootstrap = new ClientBootstrap(new DefaultLocalClientChannelFactory());
    _clientBootstrap.setPipelineFactory(new ChannelPipelineFactory() {

        @Override
        public ChannelPipeline getPipeline() throws Exception {
            ChannelPipeline clientPipeline = pipeline();
            clientPipeline.addLast("client logger 1", new LoggingHandler("client logger 1", InternalLogLevel.DEBUG, true));
            clientPipeline.addLast("codec", new HttpClientCodec());
            clientPipeline.addLast("aggregator", new FooterAwareHttpChunkAggregator(1000000));
            _responseHandler = new SimpleHttpResponseHandler();
            clientPipeline.addLast("handler", _responseHandler);
            clientPipeline.addLast("client logger 5", new LoggingHandler("client logger 5", InternalLogLevel.DEBUG, true));
            return clientPipeline;
        }
    });
}
Also used : LoggingHandler(org.jboss.netty.handler.logging.LoggingHandler) SimpleHttpResponseHandler(com.linkedin.databus.core.test.netty.SimpleHttpResponseHandler) ClientBootstrap(org.jboss.netty.bootstrap.ClientBootstrap) FooterAwareHttpChunkAggregator(com.linkedin.databus.core.test.netty.FooterAwareHttpChunkAggregator) DefaultLocalClientChannelFactory(org.jboss.netty.channel.local.DefaultLocalClientChannelFactory) HttpClientCodec(org.jboss.netty.handler.codec.http.HttpClientCodec) ChannelPipelineFactory(org.jboss.netty.channel.ChannelPipelineFactory) ChannelPipeline(org.jboss.netty.channel.ChannelPipeline)

Example 37 with ChannelPipeline

use of org.jboss.netty.channel.ChannelPipeline in project databus by linkedin.

the class SimpleTestHttpClient method createPipeline.

private ChannelPipeline createPipeline() throws Exception {
    ChannelPipeline clientPipeline = pipeline();
    clientPipeline.addLast("client logger 1", new LoggingHandler("client logger 1", InternalLogLevel.DEBUG, true));
    clientPipeline.addLast("codec", new HttpClientCodec());
    clientPipeline.addLast("aggregator", new FooterAwareHttpChunkAggregator(1000000));
    _responseHandler = new SimpleHttpResponseHandler();
    clientPipeline.addLast("handler", _responseHandler);
    clientPipeline.addLast("client logger 5", new LoggingHandler("client logger 5", InternalLogLevel.DEBUG, true));
    return clientPipeline;
}
Also used : LoggingHandler(org.jboss.netty.handler.logging.LoggingHandler) HttpClientCodec(org.jboss.netty.handler.codec.http.HttpClientCodec) ChannelPipeline(org.jboss.netty.channel.ChannelPipeline)

Example 38 with ChannelPipeline

use of org.jboss.netty.channel.ChannelPipeline in project bagheera by mozilla-metrics.

the class HttpServerPipelineFactory method getPipeline.

/* (non-Javadoc)
     * @see org.jboss.netty.channel.ChannelPipelineFactory#getPipeline()
     */
public ChannelPipeline getPipeline() throws Exception {
    ChannelPipeline pipeline = Channels.pipeline();
    pipeline.addLast("decoder", new BagheeraHttpRequestDecoder());
    pipeline.addLast("aggregator", new HttpChunkAggregator(maxContentLength));
    pipeline.addLast("contentLengthFilter", new ContentLengthFilter(maxContentLength));
    pipeline.addLast("rootResponse", new RootResponse());
    pipeline.addLast("accessFilter", new AccessFilter(validator, props));
    pipeline.addLast("encodingCorrector", new ContentEncodingCorrector());
    pipeline.addLast("inflater", new HttpContentDecompressor());
    pipeline.addLast("encoder", new HttpResponseEncoder());
    pipeline.addLast("handler", new SubmissionHandler(validator, producer, this.channelGroup, this.metricsManager));
    return pipeline;
}
Also used : HttpResponseEncoder(org.jboss.netty.handler.codec.http.HttpResponseEncoder) HttpChunkAggregator(org.jboss.netty.handler.codec.http.HttpChunkAggregator) ChannelPipeline(org.jboss.netty.channel.ChannelPipeline) HttpContentDecompressor(org.jboss.netty.handler.codec.http.HttpContentDecompressor)

Example 39 with ChannelPipeline

use of org.jboss.netty.channel.ChannelPipeline in project MSEC by Tencent.

the class NettyClientPipelineFactory method getPipeline.

public ChannelPipeline getPipeline() throws Exception {
    ChannelPipeline pipeline = pipeline();
    pipeline.addLast("decoder", decoder);
    pipeline.addLast("encoder", encoder);
    pipeline.addLast("handler", handler);
    return pipeline;
}
Also used : ChannelPipeline(org.jboss.netty.channel.ChannelPipeline)

Example 40 with ChannelPipeline

use of org.jboss.netty.channel.ChannelPipeline in project pinpoint by naver.

the class DefaultPinpointClientFactory method reconnect.

public ChannelFuture reconnect(final SocketAddress remoteAddress) {
    if (remoteAddress == null) {
        throw new NullPointerException("remoteAddress");
    }
    ChannelPipeline pipeline;
    final ClientBootstrap bootstrap = this.bootstrap;
    try {
        pipeline = bootstrap.getPipelineFactory().getPipeline();
    } catch (Exception e) {
        throw new ChannelPipelineException("Failed to initialize a pipeline.", e);
    }
    PinpointClientHandler pinpointClientHandler = (DefaultPinpointClientHandler) pipeline.getLast();
    pinpointClientHandler.initReconnect();
    // Set the options.
    Channel ch = bootstrap.getFactory().newChannel(pipeline);
    boolean success = false;
    try {
        ch.getConfig().setOptions(bootstrap.getOptions());
        success = true;
    } finally {
        if (!success) {
            ch.close();
        }
    }
    // Connect.
    return ch.connect(remoteAddress);
}
Also used : ChannelPipelineException(org.jboss.netty.channel.ChannelPipelineException) ClientBootstrap(org.jboss.netty.bootstrap.ClientBootstrap) Channel(org.jboss.netty.channel.Channel) ChannelPipeline(org.jboss.netty.channel.ChannelPipeline) PinpointSocketException(com.navercorp.pinpoint.rpc.PinpointSocketException) ChannelPipelineException(org.jboss.netty.channel.ChannelPipelineException)

Aggregations

ChannelPipeline (org.jboss.netty.channel.ChannelPipeline)165 ServerBootstrap (org.jboss.netty.bootstrap.ServerBootstrap)58 TrackerServer (org.traccar.TrackerServer)43 InetSocketAddress (java.net.InetSocketAddress)37 ChannelPipelineFactory (org.jboss.netty.channel.ChannelPipelineFactory)32 ConnectionlessBootstrap (org.jboss.netty.bootstrap.ConnectionlessBootstrap)26 Channel (org.jboss.netty.channel.Channel)26 SimpleObjectCaptureHandler (com.linkedin.databus2.test.container.SimpleObjectCaptureHandler)24 SocketAddress (java.net.SocketAddress)20 StringEncoder (org.jboss.netty.handler.codec.string.StringEncoder)18 SimpleTestServerConnection (com.linkedin.databus2.test.container.SimpleTestServerConnection)17 ChannelBuffer (org.jboss.netty.buffer.ChannelBuffer)16 NioServerSocketChannelFactory (org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory)16 HttpRequest (org.jboss.netty.handler.codec.http.HttpRequest)16 HttpResponse (org.jboss.netty.handler.codec.http.HttpResponse)16 HttpResponseEncoder (org.jboss.netty.handler.codec.http.HttpResponseEncoder)16 DefaultHttpResponse (org.jboss.netty.handler.codec.http.DefaultHttpResponse)15 HttpRequestDecoder (org.jboss.netty.handler.codec.http.HttpRequestDecoder)15 StringDecoder (org.jboss.netty.handler.codec.string.StringDecoder)14 LoggingHandler (org.jboss.netty.handler.logging.LoggingHandler)14