/**
* 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.");
}
java类org.jboss.netty.channel.SimpleChannelUpstreamHandler的实例源码
WebImageViewer.java 文件源码
项目:hadoop-2.6.0-cdh5.4.3
阅读 44
收藏 0
点赞 0
评论 0
WebImageViewer.java 文件源码
项目:FlexMap
阅读 39
收藏 0
点赞 0
评论 0
/**
* 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.");
}
HttpTunnelSoakTester.java 文件源码
项目:httptunnel
阅读 29
收藏 0
点赞 0
评论 0
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;
}
};
}
RaopRtspPipelineFactory.java 文件源码
项目:Android-Airplay-Server
阅读 35
收藏 0
点赞 0
评论 0
@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;
}
RaopRtspPipelineFactory.java 文件源码
项目:AirSpeakerMobile
阅读 36
收藏 0
点赞 0
评论 0
@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;
}
DoneCommand.java 文件源码
项目:creeper
阅读 43
收藏 0
点赞 0
评论 0
@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);
}
ChooseClassCommand.java 文件源码
项目:creeper
阅读 32
收藏 0
点赞 0
评论 0
@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);
}
LeaveCommand.java 文件源码
项目:creeper
阅读 30
收藏 0
点赞 0
评论 0
@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);
}
DoneCommand.java 文件源码
项目:creeper
阅读 26
收藏 0
点赞 0
评论 0
@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);
}
WhoisConnectionTestIntegration.java 文件源码
项目:whois
阅读 29
收藏 0
点赞 0
评论 0
@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();
}
SimpleUdpServer.java 文件源码
项目:hadoop
阅读 28
收藏 0
点赞 0
评论 0
public SimpleUdpServer(int port, SimpleChannelUpstreamHandler program,
int workerCount) {
this.port = port;
this.rpcProgram = program;
this.workerCount = workerCount;
}
SimpleUdpServer.java 文件源码
项目:aliyun-oss-hadoop-fs
阅读 35
收藏 0
点赞 0
评论 0
public SimpleUdpServer(int port, SimpleChannelUpstreamHandler program,
int workerCount) {
this.port = port;
this.rpcProgram = program;
this.workerCount = workerCount;
}
NettyClientPipelineFactory.java 文件源码
项目:nfs-rpc
阅读 29
收藏 0
点赞 0
评论 0
public NettyClientPipelineFactory(SimpleChannelUpstreamHandler handler) {
this.handler = handler;
}
SimpleUdpServer.java 文件源码
项目:big-c
阅读 32
收藏 0
点赞 0
评论 0
public SimpleUdpServer(int port, SimpleChannelUpstreamHandler program,
int workerCount) {
this.port = port;
this.rpcProgram = program;
this.workerCount = workerCount;
}
SimpleUdpServer.java 文件源码
项目:hadoop-2.6.0-cdh5.4.3
阅读 37
收藏 0
点赞 0
评论 0
public SimpleUdpServer(int port, SimpleChannelUpstreamHandler program, int workerCount) {
this.port = port;
this.rpcProgram = program;
this.workerCount = workerCount;
}
SimpleUdpServer.java 文件源码
项目:hops
阅读 34
收藏 0
点赞 0
评论 0
public SimpleUdpServer(int port, SimpleChannelUpstreamHandler program,
int workerCount) {
this.port = port;
this.rpcProgram = program;
this.workerCount = workerCount;
}
NettyClientPipelineFactory.java 文件源码
项目:migration-tool
阅读 31
收藏 0
点赞 0
评论 0
public NettyClientPipelineFactory(SimpleChannelUpstreamHandler handler){
this.handler = handler;
}
SimpleUdpServer.java 文件源码
项目:hadoop-TCP
阅读 39
收藏 0
点赞 0
评论 0
public SimpleUdpServer(int port, SimpleChannelUpstreamHandler program, int workerCount) {
this.port = port;
this.rpcProgram = program;
this.workerCount = workerCount;
}
CreeperSession.java 文件源码
项目:creeper
阅读 39
收藏 0
点赞 0
评论 0
public java.util.Optional<CreeperEntry<Merchant, SimpleChannelUpstreamHandler>> getGrabMerchant() {
return grabMerchant;
}
CreeperSession.java 文件源码
项目:creeper
阅读 30
收藏 0
点赞 0
评论 0
public void setGrabMerchant(java.util.Optional<CreeperEntry<Merchant, SimpleChannelUpstreamHandler>> grabMerchant) {
this.grabMerchant = grabMerchant;
}
SimpleUdpServer.java 文件源码
项目:hardfs
阅读 41
收藏 0
点赞 0
评论 0
public SimpleUdpServer(int port, SimpleChannelUpstreamHandler program, int workerCount) {
this.port = port;
this.rpcProgram = program;
this.workerCount = workerCount;
}
SimpleUdpServer.java 文件源码
项目:hadoop-on-lustre2
阅读 31
收藏 0
点赞 0
评论 0
public SimpleUdpServer(int port, SimpleChannelUpstreamHandler program, int workerCount) {
this.port = port;
this.rpcProgram = program;
this.workerCount = workerCount;
}