本文整理汇总了Java中org.jboss.netty.channel.ChannelPipeline.addLast方法的典型用法代码示例。如果您正苦于以下问题:Java ChannelPipeline.addLast方法的具体用法?Java ChannelPipeline.addLast怎么用?Java ChannelPipeline.addLast使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jboss.netty.channel.ChannelPipeline
的用法示例。
在下文中一共展示了ChannelPipeline.addLast方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getPipeline
import org.jboss.netty.channel.ChannelPipeline; //导入方法依赖的package包/类
@Override
public ChannelPipeline getPipeline() throws Exception {
ChannelPipeline channelPipeline = Channels.pipeline();
channelPipeline.addLast("openChannels", nettyTransport.serverOpenChannels);
SizeHeaderFrameDecoder sizeHeader = new SizeHeaderFrameDecoder();
if (nettyTransport.maxCumulationBufferCapacity != null) {
if (nettyTransport.maxCumulationBufferCapacity.bytes() > Integer.MAX_VALUE) {
sizeHeader.setMaxCumulationBufferCapacity(Integer.MAX_VALUE);
} else {
sizeHeader.setMaxCumulationBufferCapacity((int) nettyTransport.maxCumulationBufferCapacity.bytes());
}
}
if (nettyTransport.maxCompositeBufferComponents != -1) {
sizeHeader.setMaxCumulationBufferComponents(nettyTransport.maxCompositeBufferComponents);
}
channelPipeline.addLast("size", sizeHeader);
channelPipeline.addLast("dispatcher", new MessageChannelHandler(nettyTransport, nettyTransport.logger, name));
return channelPipeline;
}
示例2: connectFrom
import org.jboss.netty.channel.ChannelPipeline; //导入方法依赖的package包/类
private Channel connectFrom(InetSocketAddress connectToSocket, SocketAddress localAddress)
throws InterruptedException {
ChannelFactory channelFactory =
new NioClientSocketChannelFactory(
Executors.newCachedThreadPool(),
Executors.newCachedThreadPool());
ChannelPipelineFactory pipelineFactory = () -> {
ChannelPipeline pipeline = Channels.pipeline();
pipeline.addLast("BgpPeerFrameDecoderTest",
peerFrameDecoder);
pipeline.addLast("BgpPeerChannelHandlerTest",
peerChannelHandler);
return pipeline;
};
peerBootstrap = new ClientBootstrap(channelFactory);
peerBootstrap.setOption("child.keepAlive", true);
peerBootstrap.setOption("child.tcpNoDelay", true);
peerBootstrap.setPipelineFactory(pipelineFactory);
Channel channel = peerBootstrap.connect(connectToSocket, localAddress).getChannel();
return channel;
}
示例3: initTrackerServers
import org.jboss.netty.channel.ChannelPipeline; //导入方法依赖的package包/类
@Override
public void initTrackerServers(List<TrackerServer> serverList) {
TrackerServer server = new TrackerServer(new ServerBootstrap(), getName()) {
@Override
protected void addSpecificHandlers(ChannelPipeline pipeline) {
pipeline.addLast("frameDecoder", new MeitrackFrameDecoder());
pipeline.addLast("stringEncoder", new StringEncoder());
pipeline.addLast("objectEncoder", new MeitrackProtocolEncoder());
pipeline.addLast("objectDecoder", new MeitrackProtocolDecoder(MeitrackProtocol.this));
}
};
server.setEndianness(ByteOrder.LITTLE_ENDIAN);
serverList.add(server);
server = new TrackerServer(new ConnectionlessBootstrap(), getName()) {
@Override
protected void addSpecificHandlers(ChannelPipeline pipeline) {
pipeline.addLast("stringEncoder", new StringEncoder());
pipeline.addLast("objectEncoder", new MeitrackProtocolEncoder());
pipeline.addLast("objectDecoder", new MeitrackProtocolDecoder(MeitrackProtocol.this));
}
};
server.setEndianness(ByteOrder.LITTLE_ENDIAN);
serverList.add(server);
}
示例4: initTrackerServers
import org.jboss.netty.channel.ChannelPipeline; //导入方法依赖的package包/类
@Override
public void initTrackerServers(List<TrackerServer> serverList) {
TrackerServer server = new TrackerServer(new ServerBootstrap(), getName()) {
@Override
protected void addSpecificHandlers(ChannelPipeline pipeline) {
pipeline.addLast("frameDecoder", new LengthFieldBasedFrameDecoder(1024, 2, 2, -4, 0));
pipeline.addLast("objectDecoder", new CastelProtocolDecoder(CastelProtocol.this));
}
};
server.setEndianness(ByteOrder.LITTLE_ENDIAN);
serverList.add(server);
server = new TrackerServer(new ConnectionlessBootstrap(), getName()) {
@Override
protected void addSpecificHandlers(ChannelPipeline pipeline) {
pipeline.addLast("objectDecoder", new CastelProtocolDecoder(CastelProtocol.this));
}
};
server.setEndianness(ByteOrder.LITTLE_ENDIAN);
serverList.add(server);
}
示例5: getPipeline
import org.jboss.netty.channel.ChannelPipeline; //导入方法依赖的package包/类
@Override
public ChannelPipeline getPipeline() throws Exception {
BgpChannelHandler handler = new BgpChannelHandler(bgpController);
ChannelPipeline pipeline = Channels.pipeline();
pipeline.addLast("bgpmessagedecoder", new BgpMessageDecoder());
pipeline.addLast("bgpmessageencoder", new BgpMessageEncoder());
pipeline.addLast("holdTime", readTimeoutHandler);
if (isBgpServ) {
pipeline.addLast("PassiveHandler", handler);
} else {
pipeline.addLast("ActiveHandler", handler);
}
return pipeline;
}
示例6: getPipeline
import org.jboss.netty.channel.ChannelPipeline; //导入方法依赖的package包/类
@Override
public ChannelPipeline getPipeline() throws Exception {
RPCChannelHandler channelHandler =
new RPCChannelHandler(syncManager, rpcService);
IdleStateHandler idleHandler =
new IdleStateHandler(timer, 5, 10, 0);
ReadTimeoutHandler readTimeoutHandler =
new ReadTimeoutHandler(timer, 30);
ChannelPipeline pipeline = Channels.pipeline();
pipeline.addLast("idle", idleHandler);
pipeline.addLast("timeout", readTimeoutHandler);
pipeline.addLast("handshaketimeout",
new HandshakeTimeoutHandler(channelHandler, timer, 10));
pipeline.addLast("frameDecoder",
new ThriftFrameDecoder(maxFrameSize));
pipeline.addLast("frameEncoder",
new ThriftFrameEncoder());
pipeline.addLast("handler", channelHandler);
return pipeline;
}
示例7: getPipeline
import org.jboss.netty.channel.ChannelPipeline; //导入方法依赖的package包/类
@Override
public ChannelPipeline getPipeline() throws Exception {
BootstrapChannelHandler handler =
new BootstrapChannelHandler(bootstrap);
ChannelPipeline pipeline = Channels.pipeline();
pipeline.addLast("frameDecoder",
new ThriftFrameDecoder(maxFrameSize));
pipeline.addLast("frameEncoder",
new ThriftFrameEncoder());
pipeline.addLast("timeout",
new BootstrapTimeoutHandler(timer, 10));
pipeline.addLast("handler", handler);
return pipeline;
}
示例8: getPipeline
import org.jboss.netty.channel.ChannelPipeline; //导入方法依赖的package包/类
@Override
public ChannelPipeline getPipeline() throws Exception {
ChannelPipeline pipeline = Channels.pipeline();
pipeline.addLast("encoder", new IsisMessageDecoder());
pipeline.addLast("decoder", new IsisMessageEncoder());
pipeline.addLast("handler", isisChannelHandler);
return pipeline;
}
示例9: initSSL
import org.jboss.netty.channel.ChannelPipeline; //导入方法依赖的package包/类
private synchronized void initSSL(ChannelPipeline p)
throws X509Exception, KeyManagementException, NoSuchAlgorithmException {
String authProviderProp = System.getProperty(ZKConfig.SSL_AUTHPROVIDER);
SSLContext sslContext;
if (authProviderProp == null) {
sslContext = X509Util.createSSLContext();
} else {
sslContext = SSLContext.getInstance("TLSv1");
X509AuthenticationProvider authProvider =
(X509AuthenticationProvider)ProviderRegistry.getProvider(
System.getProperty(ZKConfig.SSL_AUTHPROVIDER,
"x509"));
if (authProvider == null)
{
LOG.error("Auth provider not found: {}", authProviderProp);
throw new SSLContextException(
"Could not create SSLContext with specified auth provider: " +
authProviderProp);
}
sslContext.init(new X509KeyManager[] { authProvider.getKeyManager() },
new X509TrustManager[] { authProvider.getTrustManager() },
null);
}
SSLEngine sslEngine = sslContext.createSSLEngine();
sslEngine.setUseClientMode(false);
sslEngine.setNeedClientAuth(true);
p.addLast("ssl", new SslHandler(sslEngine));
LOG.info("SSL handler added for channel: {}", p.getChannel());
}
示例10: initTrackerServers
import org.jboss.netty.channel.ChannelPipeline; //导入方法依赖的package包/类
@Override
public void initTrackerServers(List<TrackerServer> serverList) {
TrackerServer server = new TrackerServer(new ServerBootstrap(), getName()) {
@Override
protected void addSpecificHandlers(ChannelPipeline pipeline) {
pipeline.addLast("frameDecoder", new TramigoFrameDecoder());
pipeline.addLast("objectDecoder", new TramigoProtocolDecoder(TramigoProtocol.this));
}
};
server.setEndianness(ByteOrder.LITTLE_ENDIAN);
serverList.add(server);
}
示例11: addDynamicHandlers
import org.jboss.netty.channel.ChannelPipeline; //导入方法依赖的package包/类
private void addDynamicHandlers(ChannelPipeline pipeline) {
if (Context.getConfig().hasKey("extra.handlers")) {
String[] handlers = Context.getConfig().getString("extra.handlers").split(",");
for (int i = 0; i < handlers.length; i++) {
try {
pipeline.addLast("extraHandler." + i, (ChannelHandler) Class.forName(handlers[i]).newInstance());
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException error) {
Log.warning(error);
}
}
}
}
示例12: initTrackerServers
import org.jboss.netty.channel.ChannelPipeline; //导入方法依赖的package包/类
@Override
public void initTrackerServers(List<TrackerServer> serverList) {
TrackerServer server = new TrackerServer(new ServerBootstrap(), getName()) {
@Override
protected void addSpecificHandlers(ChannelPipeline pipeline) {
pipeline.addLast("frameDecoder", new LengthFieldBasedFrameDecoder(1024, 2, 2, 4, 0));
pipeline.addLast("objectDecoder", new ProgressProtocolDecoder(ProgressProtocol.this));
}
};
server.setEndianness(ByteOrder.LITTLE_ENDIAN);
serverList.add(server);
}
示例13: initTrackerServers
import org.jboss.netty.channel.ChannelPipeline; //导入方法依赖的package包/类
@Override
public void initTrackerServers(List<TrackerServer> serverList) {
TrackerServer server = new TrackerServer(new ServerBootstrap(), getName()) {
@Override
protected void addSpecificHandlers(ChannelPipeline pipeline) {
pipeline.addLast("frameDecoder", new GalileoFrameDecoder());
pipeline.addLast("objectDecoder", new BlackKiteProtocolDecoder(BlackKiteProtocol.this));
}
};
server.setEndianness(ByteOrder.LITTLE_ENDIAN);
serverList.add(server);
}
示例14: initTrackerServers
import org.jboss.netty.channel.ChannelPipeline; //导入方法依赖的package包/类
@Override
public void initTrackerServers(List<TrackerServer> serverList) {
TrackerServer server = new TrackerServer(new ServerBootstrap(), getName()) {
@Override
protected void addSpecificHandlers(ChannelPipeline pipeline) {
pipeline.addLast("frameDecoder", new Pt502FrameDecoder());
pipeline.addLast("stringEncoder", new StringEncoder());
pipeline.addLast("stringDecoder", new StringDecoder());
pipeline.addLast("objectEncoder", new Pt502ProtocolEncoder());
pipeline.addLast("objectDecoder", new Pt502ProtocolDecoder(Pt502Protocol.this));
}
};
server.setEndianness(ByteOrder.LITTLE_ENDIAN);
serverList.add(server);
}
示例15: initTrackerServers
import org.jboss.netty.channel.ChannelPipeline; //导入方法依赖的package包/类
@Override
public void initTrackerServers(List<TrackerServer> serverList) {
TrackerServer server = new TrackerServer(new ServerBootstrap(), getName()) {
@Override
protected void addSpecificHandlers(ChannelPipeline pipeline) {
pipeline.addLast("frameDecoder", new MxtFrameDecoder());
pipeline.addLast("objectDecoder", new MxtProtocolDecoder(MxtProtocol.this));
}
};
server.setEndianness(ByteOrder.LITTLE_ENDIAN);
serverList.add(server);
}