本文整理匯總了Java中org.jboss.netty.channel.SimpleChannelUpstreamHandler類的典型用法代碼示例。如果您正苦於以下問題:Java SimpleChannelUpstreamHandler類的具體用法?Java SimpleChannelUpstreamHandler怎麽用?Java SimpleChannelUpstreamHandler使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
SimpleChannelUpstreamHandler類屬於org.jboss.netty.channel包,在下文中一共展示了SimpleChannelUpstreamHandler類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: initServer
import org.jboss.netty.channel.SimpleChannelUpstreamHandler; //導入依賴的package包/類
/**
* Start WebImageViewer.
* @param fsimage the fsimage to load.
* @throws IOException if fail to load the fsimage.
*/
@VisibleForTesting
public void initServer(String fsimage) throws IOException {
FSImageLoader loader = FSImageLoader.load(fsimage);
ChannelPipeline pipeline = Channels.pipeline();
pipeline.addLast("channelTracker", new SimpleChannelUpstreamHandler() {
@Override
public void channelOpen(ChannelHandlerContext ctx, ChannelStateEvent e)
throws Exception {
allChannels.add(e.getChannel());
}
});
pipeline.addLast("httpDecoder", new HttpRequestDecoder());
pipeline.addLast("requestHandler", new FSImageHandler(loader));
pipeline.addLast("stringEncoder", new StringEncoder());
pipeline.addLast("httpEncoder", new HttpResponseEncoder());
bootstrap.setPipeline(pipeline);
channel = bootstrap.bind(address);
allChannels.add(channel);
address = (InetSocketAddress) channel.getLocalAddress();
LOG.info("WebImageViewer started. Listening on " + address.toString()
+ ". Press Ctrl+C to stop the viewer.");
}
示例2: createServerPipelineFactory
import org.jboss.netty.channel.SimpleChannelUpstreamHandler; //導入依賴的package包/類
protected ChannelPipelineFactory createServerPipelineFactory() {
return new ChannelPipelineFactory() {
@Override
public ChannelPipeline getPipeline() throws Exception {
ChannelPipeline pipeline = Channels.pipeline();
pipeline.addLast("c2sVerifier", c2sVerifier);
pipeline.addLast("throttleControl", new SendThrottle(
s2cDataSender));
pipeline.addLast("sendStarter",
new SimpleChannelUpstreamHandler() {
@Override
public void channelConnected(
ChannelHandlerContext ctx,
ChannelStateEvent e) throws Exception {
Channel childChannel = e.getChannel();
channels.add(childChannel);
s2cDataSender.setChannel(childChannel);
executor.execute(s2cDataSender);
}
});
return pipeline;
}
};
}
示例3: getPipeline
import org.jboss.netty.channel.SimpleChannelUpstreamHandler; //導入依賴的package包/類
@Override
public ChannelPipeline getPipeline() throws Exception {
final ChannelPipeline pipeline = Channels.pipeline();
final AirPlayServer airPlayServer = AirPlayServer.getIstance();
pipeline.addLast("executionHandler", airPlayServer.getChannelExecutionHandler());
pipeline.addLast("closeOnShutdownHandler", new SimpleChannelUpstreamHandler() {
@Override
public void channelOpen(final ChannelHandlerContext ctx, final ChannelStateEvent e) throws Exception {
airPlayServer.getChannelGroup().add(e.getChannel());
super.channelOpen(ctx, e);
}
});
pipeline.addLast("exceptionLogger", new ExceptionLoggingHandler());
pipeline.addLast("decoder", new RtspRequestDecoder());
pipeline.addLast("encoder", new RtspResponseEncoder());
pipeline.addLast("logger", new RtspLoggingHandler());
pipeline.addLast("errorResponse", new RtspErrorResponseHandler());
pipeline.addLast("challengeResponse", new RaopRtspChallengeResponseHandler(NetworkUtils.getInstance().getHardwareAddress()));
pipeline.addLast("header", new RaopRtspHeaderHandler());
pipeline.addLast("options", new RaopRtspOptionsHandler());
pipeline.addLast("audio", new RaopAudioHandler(airPlayServer.getExecutorService()));
pipeline.addLast("unsupportedResponse", new RtspUnsupportedResponseHandler());
return pipeline;
}
示例4: getPipeline
import org.jboss.netty.channel.SimpleChannelUpstreamHandler; //導入依賴的package包/類
@Override
public ChannelPipeline getPipeline() throws Exception {
final ChannelPipeline pipeline = Channels.pipeline();
final AirPlayServer airPlayServer = AirPlayServer.getIstance(context);
pipeline.addLast("executionHandler", airPlayServer.getChannelExecutionHandler());
pipeline.addLast("closeOnShutdownHandler", new SimpleChannelUpstreamHandler() {
@Override
public void channelOpen(final ChannelHandlerContext ctx, final ChannelStateEvent e) throws Exception {
airPlayServer.getChannelGroup().add(e.getChannel());
super.channelOpen(ctx, e);
}
});
pipeline.addLast("exceptionLogger", new ExceptionLoggingHandler());
pipeline.addLast("decoder", new RtspRequestDecoder());
pipeline.addLast("encoder", new RtspResponseEncoder());
//pipeline.addLast("aggregator", new HttpChunkAggregator(655360));//buffer size
pipeline.addLast("logger", new RtspLoggingHandler(context));
pipeline.addLast("errorResponse", new RtspErrorResponseHandler());
pipeline.addLast("challengeResponse", new RaopRtspChallengeResponseHandler(NetworkUtils.getInstance().getHardwareAddress()));
pipeline.addLast("header", new RaopRtspHeaderHandler());
pipeline.addLast("options", new RaopRtspOptionsHandler());
pipeline.addLast("audio", new RaopAudioHandler(airPlayServer.getExecutorService(),context));
pipeline.addLast("unsupportedResponse", new RtspUnsupportedResponseHandler());
return pipeline;
}
示例5: messageReceived
import org.jboss.netty.channel.SimpleChannelUpstreamHandler; //導入依賴的package包/類
@Override
public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) throws Exception {
configure(e);
gameManager.getChannelUtils().write(playerId, "Thanks, COME AGAIN." + "\r\n", true);
creeperSession.setGrabMerchant(Optional.<CreeperEntry<Merchant, SimpleChannelUpstreamHandler>>empty());
e.getChannel().getPipeline().remove("executed_command");
e.getChannel().getPipeline().remove("executed_bank_command");
String s = gameManager.buildPrompt(playerId);
write(s);
}
示例6: messageReceived
import org.jboss.netty.channel.SimpleChannelUpstreamHandler; //導入依賴的package包/類
@Override
public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) throws Exception {
configure(e);
creeperSession.setGrabMerchant(Optional.<CreeperEntry<Merchant, SimpleChannelUpstreamHandler>>empty());
player.setPlayerClass(playerClass);
write("You are now and forever, a " + CreeperUtils.capitalize(playerClass.getIdentifier()) + "\r\n");
e.getChannel().getPipeline().remove("executed_command");
e.getChannel().getPipeline().remove("executed_playerclass_command");
String s = gameManager.buildPrompt(playerId);
write(s);
}
示例7: messageReceived
import org.jboss.netty.channel.SimpleChannelUpstreamHandler; //導入依賴的package包/類
@Override
public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) throws Exception {
configure(e);
creeperSession.setGrabMerchant(Optional.<CreeperEntry<Merchant, SimpleChannelUpstreamHandler>>empty());
e.getChannel().getPipeline().remove("executed_command");
e.getChannel().getPipeline().remove("executed_playerclass_command");
String s = gameManager.buildPrompt(playerId);
write(s);
}
示例8: messageReceived
import org.jboss.netty.channel.SimpleChannelUpstreamHandler; //導入依賴的package包/類
@Override
public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) throws Exception {
configure(e);
creeperSession.setGrabMerchant(Optional.<CreeperEntry<Merchant, SimpleChannelUpstreamHandler>>empty());
e.getChannel().getPipeline().remove("executed_command");
e.getChannel().getPipeline().remove("executed_locker_command");
String s = gameManager.buildPrompt(playerId);
write(s);
}
示例9: setUp
import org.jboss.netty.channel.SimpleChannelUpstreamHandler; //導入依賴的package包/類
@Before
public void setUp() throws Exception {
upstreamMock = Mockito.mock(SimpleChannelUpstreamHandler.class, Answers.CALLS_REAL_METHODS.get());
ChannelPipeline pipeline = Channels.pipeline();
pipeline.addLast("open-channels", queryChannelsRegistry);
pipeline.addLast("delimiter", new DelimiterBasedFrameDecoder(1024, true, ChannelBuffers.wrappedBuffer(new byte[]{'\n'})));
pipeline.addLast("string-decoder", new StringDecoder(Charsets.UTF_8));
pipeline.addLast("whois-encoder", applicationContext.getBean(WhoisEncoder.class));
pipeline.addLast("exception", new ExceptionHandler());
pipeline.addLast("query-decoder", applicationContext.getBean(QueryDecoder.class));
pipeline.addLast("connection-state", new ConnectionStateHandler());
pipeline.addLast("upstreamMock", upstreamMock);
when(whoisServerPipelineFactory.getPipeline()).thenReturn(pipeline);
doAnswer(new Answer() {
@Override
public Object answer(final InvocationOnMock invocationOnMock) throws Throwable {
ResponseHandler responseHandler = (ResponseHandler) invocationOnMock.getArguments()[3];
responseHandler.handle(RpslObject.parse(queryResult));
return null;
}
}).when(queryHandler).streamResults(any(Query.class), any(InetAddress.class), anyInt(), any(ResponseHandler.class));
queryServer.start();
}
示例10: SimpleUdpServer
import org.jboss.netty.channel.SimpleChannelUpstreamHandler; //導入依賴的package包/類
public SimpleUdpServer(int port, SimpleChannelUpstreamHandler program,
int workerCount) {
this.port = port;
this.rpcProgram = program;
this.workerCount = workerCount;
}
示例11: NettyClientPipelineFactory
import org.jboss.netty.channel.SimpleChannelUpstreamHandler; //導入依賴的package包/類
public NettyClientPipelineFactory(SimpleChannelUpstreamHandler handler) {
this.handler = handler;
}
示例12: SimpleUdpServer
import org.jboss.netty.channel.SimpleChannelUpstreamHandler; //導入依賴的package包/類
public SimpleUdpServer(int port, SimpleChannelUpstreamHandler program, int workerCount) {
this.port = port;
this.rpcProgram = program;
this.workerCount = workerCount;
}
示例13: NettyClientPipelineFactory
import org.jboss.netty.channel.SimpleChannelUpstreamHandler; //導入依賴的package包/類
public NettyClientPipelineFactory(SimpleChannelUpstreamHandler handler){
this.handler = handler;
}
示例14: getGrabMerchant
import org.jboss.netty.channel.SimpleChannelUpstreamHandler; //導入依賴的package包/類
public java.util.Optional<CreeperEntry<Merchant, SimpleChannelUpstreamHandler>> getGrabMerchant() {
return grabMerchant;
}
示例15: setGrabMerchant
import org.jboss.netty.channel.SimpleChannelUpstreamHandler; //導入依賴的package包/類
public void setGrabMerchant(java.util.Optional<CreeperEntry<Merchant, SimpleChannelUpstreamHandler>> grabMerchant) {
this.grabMerchant = grabMerchant;
}