當前位置: 首頁>>代碼示例>>Java>>正文


Java SimpleChannelUpstreamHandler類代碼示例

本文整理匯總了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.");
}
 
開發者ID:Nextzero,項目名稱:hadoop-2.6.0-cdh5.4.3,代碼行數:30,代碼來源:WebImageViewer.java

示例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;
		}
	};
}
 
開發者ID:reines,項目名稱:httptunnel,代碼行數:26,代碼來源:HttpTunnelSoakTester.java

示例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;
}
 
開發者ID:SergioChan,項目名稱:Android-Airplay-Server,代碼行數:28,代碼來源:RaopRtspPipelineFactory.java

示例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;
}
 
開發者ID:lukeqsun,項目名稱:AirSpeakerMobile,代碼行數:30,代碼來源:RaopRtspPipelineFactory.java

示例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);
}
 
開發者ID:chriskearney,項目名稱:creeper,代碼行數:11,代碼來源:DoneCommand.java

示例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);
}
 
開發者ID:chriskearney,項目名稱:creeper,代碼行數:12,代碼來源:ChooseClassCommand.java

示例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);
}
 
開發者ID:chriskearney,項目名稱:creeper,代碼行數:10,代碼來源:LeaveCommand.java

示例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);
}
 
開發者ID:chriskearney,項目名稱:creeper,代碼行數:10,代碼來源:DoneCommand.java

示例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();
}
 
開發者ID:RIPE-NCC,項目名稱:whois,代碼行數:28,代碼來源:WhoisConnectionTestIntegration.java

示例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;
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:7,代碼來源:SimpleUdpServer.java

示例11: NettyClientPipelineFactory

import org.jboss.netty.channel.SimpleChannelUpstreamHandler; //導入依賴的package包/類
public NettyClientPipelineFactory(SimpleChannelUpstreamHandler handler) {
  this.handler = handler;
}
 
開發者ID:leeyazhou,項目名稱:nfs-rpc,代碼行數:4,代碼來源:NettyClientPipelineFactory.java

示例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;
}
 
開發者ID:Nextzero,項目名稱:hadoop-2.6.0-cdh5.4.3,代碼行數:6,代碼來源:SimpleUdpServer.java

示例13: NettyClientPipelineFactory

import org.jboss.netty.channel.SimpleChannelUpstreamHandler; //導入依賴的package包/類
public NettyClientPipelineFactory(SimpleChannelUpstreamHandler handler){
	this.handler = handler;
}
 
開發者ID:liuxinglanyue,項目名稱:migration-tool,代碼行數:4,代碼來源:NettyClientPipelineFactory.java

示例14: getGrabMerchant

import org.jboss.netty.channel.SimpleChannelUpstreamHandler; //導入依賴的package包/類
public java.util.Optional<CreeperEntry<Merchant, SimpleChannelUpstreamHandler>> getGrabMerchant() {
    return grabMerchant;
}
 
開發者ID:chriskearney,項目名稱:creeper,代碼行數:4,代碼來源:CreeperSession.java

示例15: setGrabMerchant

import org.jboss.netty.channel.SimpleChannelUpstreamHandler; //導入依賴的package包/類
public void setGrabMerchant(java.util.Optional<CreeperEntry<Merchant, SimpleChannelUpstreamHandler>> grabMerchant) {
    this.grabMerchant = grabMerchant;
}
 
開發者ID:chriskearney,項目名稱:creeper,代碼行數:4,代碼來源:CreeperSession.java


注:本文中的org.jboss.netty.channel.SimpleChannelUpstreamHandler類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。