Search in sources :

Example 41 with ChannelPipeline

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

the class ServerPipelineFactory method getPipeline.

@Override
public ChannelPipeline getPipeline() throws Exception {
    ChannelPipeline pipeline = Channels.pipeline();
    pipeline.addLast("decoder", new PacketDecoder());
    pipeline.addLast("encoder", new PacketEncoder());
    pipeline.addLast("handler", pinpointServerChannelHandler);
    return pipeline;
}
Also used : PacketEncoder(com.navercorp.pinpoint.rpc.codec.PacketEncoder) PacketDecoder(com.navercorp.pinpoint.rpc.codec.PacketDecoder) ChannelPipeline(org.jboss.netty.channel.ChannelPipeline)

Example 42 with ChannelPipeline

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

the class PinpointClientPipelineFactory method getPipeline.

@Override
public ChannelPipeline getPipeline() throws Exception {
    ChannelPipeline pipeline = Channels.pipeline();
    pipeline.addLast("encoder", new PacketEncoder());
    pipeline.addLast("decoder", new PacketDecoder());
    long pingDelay = pinpointClientFactory.getPingDelay();
    long enableWorkerPacketDelay = pinpointClientFactory.getEnableWorkerPacketDelay();
    long timeoutMillis = pinpointClientFactory.getTimeoutMillis();
    DefaultPinpointClientHandler defaultPinpointClientHandler = new DefaultPinpointClientHandler(pinpointClientFactory, pingDelay, enableWorkerPacketDelay, timeoutMillis);
    pipeline.addLast("writeTimeout", new WriteTimeoutHandler(defaultPinpointClientHandler.getChannelTimer(), 3000, TimeUnit.MILLISECONDS));
    pipeline.addLast("socketHandler", defaultPinpointClientHandler);
    return pipeline;
}
Also used : PacketEncoder(com.navercorp.pinpoint.rpc.codec.PacketEncoder) WriteTimeoutHandler(org.jboss.netty.handler.timeout.WriteTimeoutHandler) PacketDecoder(com.navercorp.pinpoint.rpc.codec.PacketDecoder) ChannelPipeline(org.jboss.netty.channel.ChannelPipeline)

Example 43 with ChannelPipeline

use of org.jboss.netty.channel.ChannelPipeline in project neo4j by neo4j.

the class Server method getPipeline.

@Override
public ChannelPipeline getPipeline() throws Exception {
    ChannelPipeline pipeline = Channels.pipeline();
    pipeline.addLast("monitor", new MonitorChannelHandler(byteCounterMonitor));
    addLengthFieldPipes(pipeline, frameLength);
    pipeline.addLast("serverHandler", this);
    return pipeline;
}
Also used : ChannelPipeline(org.jboss.netty.channel.ChannelPipeline)

Example 44 with ChannelPipeline

use of org.jboss.netty.channel.ChannelPipeline in project yyl_example by Relucent.

the class NettyClient method main.

public static void main(String[] args) {
    ClientBootstrap bootstrap = new ClientBootstrap(new //
    NioClientSocketChannelFactory(//
    Executors.newCachedThreadPool(), //
    Executors.newCachedThreadPool()));
    // Set up the default event pipeline.
    bootstrap.setPipelineFactory(new ChannelPipelineFactory() {

        @Override
        public ChannelPipeline getPipeline() throws Exception {
            return Channels.pipeline(new StringDecoder(), new StringEncoder(), new ClientHandler());
        }
    });
    // Start the connection attempt.
    ChannelFuture future = bootstrap.connect(new InetSocketAddress("localhost", 8000));
    // Wait until the connection is closed or the connection attempt fails.
    future.getChannel().getCloseFuture().awaitUninterruptibly();
    // Shut down thread pools to exit.
    bootstrap.releaseExternalResources();
}
Also used : StringEncoder(org.jboss.netty.handler.codec.string.StringEncoder) ChannelFuture(org.jboss.netty.channel.ChannelFuture) ClientBootstrap(org.jboss.netty.bootstrap.ClientBootstrap) InetSocketAddress(java.net.InetSocketAddress) StringDecoder(org.jboss.netty.handler.codec.string.StringDecoder) ChannelPipelineFactory(org.jboss.netty.channel.ChannelPipelineFactory) ChannelPipeline(org.jboss.netty.channel.ChannelPipeline)

Example 45 with ChannelPipeline

use of org.jboss.netty.channel.ChannelPipeline in project Protocol-Adapter-IEC61850 by OSGP.

the class Iec61850Config method createChannelPipeline.

private ChannelPipeline createChannelPipeline(final ChannelHandler handler) throws ProtocolAdapterException {
    final ChannelPipeline pipeline = Channels.pipeline();
    pipeline.addLast("loggingHandler", new LoggingHandler(InternalLogLevel.INFO, true));
    pipeline.addLast("iec61850RegisterDeviceRequestDecoder", new RegisterDeviceRequestDecoder());
    pipeline.addLast("iec61850ChannelHandler", handler);
    return pipeline;
}
Also used : LoggingHandler(org.jboss.netty.handler.logging.LoggingHandler) RegisterDeviceRequestDecoder(com.alliander.osgp.adapter.protocol.iec61850.infra.networking.RegisterDeviceRequestDecoder) ChannelPipeline(org.jboss.netty.channel.ChannelPipeline)

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