use of org.jboss.netty.channel.ChannelPipeline in project cdap by caskdata.
the class ClientChannelPipelineFactory method getPipeline.
@Override
public ChannelPipeline getPipeline() throws Exception {
ChannelPipeline pipeline = Channels.pipeline();
pipeline.addLast("tracker", connectionTracker);
pipeline.addLast("request-encoder", new HttpRequestEncoder());
// outbound handler gets dynamically added here (after 'request-encoder')
pipeline.addLast("response-decoder", new HttpResponseDecoder());
// disable the read-specific and write-specific timeouts; we only utilize IdleState#ALL_IDLE
pipeline.addLast("idle-event-generator", new IdleStateHandler(timer, 0, 0, connectionTimeout));
pipeline.addLast("idle-event-processor", new IdleEventProcessor());
return pipeline;
}
use of org.jboss.netty.channel.ChannelPipeline in project opennms by OpenNMS.
the class AsyncBasicDetectorNettyImpl method isServiceDetected.
/**
* {@inheritDoc}
*/
@Override
public final DetectFuture isServiceDetected(final InetAddress address) {
DetectFuture detectFuture = new DetectFutureFailedImpl(this, new IllegalStateException());
try {
ClientBootstrap bootstrap = new ClientBootstrap(m_factory);
bootstrap.setPipelineFactory(new ChannelPipelineFactory() {
@Override
public ChannelPipeline getPipeline() throws Exception {
ChannelPipeline retval = Channels.pipeline();
// Upstream handlers
// retval.addLast("retryHandler", new RetryChannelHandler());
appendToPipeline(retval);
// Downstream handlers
retval.addLast("detectorHandler", getDetectorHandler(getConversation()));
if (isUseSSLFilter()) {
// Use a relaxed SSL context
retval.addLast("sslHandler", new SslHandler(createClientSSLContext().createSSLEngine()));
}
return retval;
}
});
bootstrap.setOption("tcpNoDelay", true);
bootstrap.setOption("keepAlive", true);
SocketAddress remoteAddress = new InetSocketAddress(address, getPort());
ChannelFuture future = bootstrap.connect(remoteAddress);
future.addListener(new RetryChannelFutureListener(remoteAddress, this.getRetries()));
detectFuture = new DetectFutureNettyImpl(this, future);
} catch (Throwable e) {
detectFuture = new DetectFutureFailedImpl(this, e);
}
return detectFuture;
}
use of org.jboss.netty.channel.ChannelPipeline in project NabAlive by jcheype.
the class HttpApiServerPipelineFactory method getPipeline.
@Override
public ChannelPipeline getPipeline() throws Exception {
ChannelPipeline pipeline = pipeline();
// Uncomment the following line if you want HTTPS
// SSLEngine engine = //SecureChatSslContextFactory.getServerContext().createSSLEngine();
// engine.setUseClientMode(false);
// pipeline.addLast("ssl", new SslHandler(engine));
pipeline.addLast("timeout", new IdleStateHandler(timer, 0, 0, 20));
pipeline.addLast("decoder", new HttpRequestDecoder());
pipeline.addLast("encoder", new HttpResponseEncoder());
// pipeline.addLast("comressor", new HttpContentCompressor(9));
pipeline.addLast("aggregator", new HttpChunkAggregator(65536));
pipeline.addLast("chunkedWriter", new ChunkedWriteHandler());
//pipeline.addLast("executor", eh);
pipeline.addLast("handler", handler);
return pipeline;
}
use of org.jboss.netty.channel.ChannelPipeline in project NabAlive by jcheype.
the class NabaliveServer method start.
@PostConstruct
public void start() {
logger.info("Starting server.");
// Configure the server.
bootstrap = new ServerBootstrap(new NioServerSocketChannelFactory(Executors.newCachedThreadPool(), Executors.newCachedThreadPool()));
// Set up the pipeline factory.
bootstrap.setPipelineFactory(new ChannelPipelineFactory() {
public ChannelPipeline getPipeline() throws Exception {
ChannelPipeline pipeline = pipeline();
pipeline.addLast("timeout", new IdleStateHandler(timer, 0, 0, 20));
pipeline.addLast("nabaliveServerHandler", nabaliveServerHandler);
return pipeline;
}
});
bootstrap.setOption("reuseAddress", true);
// Bind and start to accept incoming connections.
bind = bootstrap.bind(new InetSocketAddress(XMPP_PORT));
}
use of org.jboss.netty.channel.ChannelPipeline in project bigbluebutton by bigbluebutton.
the class AbstractOutboundPipelineFactory method getPipeline.
public ChannelPipeline getPipeline() throws Exception {
ChannelPipeline pipeline = Channels.pipeline();
// Add the text line codec combination first
pipeline.addLast("encoder", new StringEncoder());
// Note that outbound mode requires the decoder to treat many 'headers' as body lines
pipeline.addLast("decoder", new EslFrameDecoder(8092, true));
// Add an executor to ensure separate thread for each upstream message from here
pipeline.addLast("executor", new ExecutionHandler(new OrderedMemoryAwareThreadPoolExecutor(16, 1048576, 1048576)));
// now the outbound client logic
pipeline.addLast("clientHandler", makeHandler());
return pipeline;
}
Aggregations