本文整理汇总了Java中org.jboss.netty.channel.DefaultChannelPipeline类的典型用法代码示例。如果您正苦于以下问题:Java DefaultChannelPipeline类的具体用法?Java DefaultChannelPipeline怎么用?Java DefaultChannelPipeline使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DefaultChannelPipeline类属于org.jboss.netty.channel包,在下文中一共展示了DefaultChannelPipeline类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: start
import org.jboss.netty.channel.DefaultChannelPipeline; //导入依赖的package包/类
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);
}
示例2: start
import org.jboss.netty.channel.DefaultChannelPipeline; //导入依赖的package包/类
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()));
}
示例3: start
import org.jboss.netty.channel.DefaultChannelPipeline; //导入依赖的package包/类
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()));
}
示例4: start
import org.jboss.netty.channel.DefaultChannelPipeline; //导入依赖的package包/类
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);
}
示例5: getPipeline
import org.jboss.netty.channel.DefaultChannelPipeline; //导入依赖的package包/类
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;
}
示例6: getPipeline
import org.jboss.netty.channel.DefaultChannelPipeline; //导入依赖的package包/类
@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;
}
示例7: createChannelPipelineFactory
import org.jboss.netty.channel.DefaultChannelPipeline; //导入依赖的package包/类
@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;
}
};
}
示例8: getPipeline
import org.jboss.netty.channel.DefaultChannelPipeline; //导入依赖的package包/类
@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;
}
示例9: run
import org.jboss.netty.channel.DefaultChannelPipeline; //导入依赖的package包/类
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 + '/');
}
示例10: getPipeline
import org.jboss.netty.channel.DefaultChannelPipeline; //导入依赖的package包/类
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;
}
示例11: addChunkHandlesNonExistingChunkList
import org.jboss.netty.channel.DefaultChannelPipeline; //导入依赖的package包/类
@Test
public void addChunkHandlesNonExistingChunkList() {
DefaultLocalClientChannelFactory channelFactory = new DefaultLocalClientChannelFactory();
DefaultChannelPipeline pipeline = new DefaultChannelPipeline();
Channel channel = channelFactory.newChannel(pipeline);
chunkedRequestAssembler.addChunk(channel, EMPTY_CHUNK);
}
示例12: addChunkHandlesNullChunk
import org.jboss.netty.channel.DefaultChannelPipeline; //导入依赖的package包/类
@Test
public void addChunkHandlesNullChunk() {
DefaultLocalClientChannelFactory channelFactory = new DefaultLocalClientChannelFactory();
DefaultChannelPipeline pipeline = new DefaultChannelPipeline();
Channel channel = channelFactory.newChannel(pipeline);
chunkedRequestAssembler.addChunk(channel, null);
}
示例13: addChunkHandlesExistingChunkList
import org.jboss.netty.channel.DefaultChannelPipeline; //导入依赖的package包/类
@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);
}