Java 类org.jboss.netty.channel.SimpleChannelUpstreamHandler 实例源码

项目:hadoop-2.6.0-cdh5.4.3    文件:WebImageViewer.java   
/**
 * 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.");
}
项目:FlexMap    文件:WebImageViewer.java   
/**
 * 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.");
}
项目:httptunnel    文件:HttpTunnelSoakTester.java   
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;
        }
    };
}
项目:Android-Airplay-Server    文件:RaopRtspPipelineFactory.java   
@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;
}
项目:AirSpeakerMobile    文件:RaopRtspPipelineFactory.java   
@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;
}
项目:creeper    文件:DoneCommand.java   
@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);
}
项目:creeper    文件:ChooseClassCommand.java   
@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);
}
项目:creeper    文件:LeaveCommand.java   
@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);
}
项目:creeper    文件:DoneCommand.java   
@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);
}
项目:whois    文件:WhoisConnectionTestIntegration.java   
@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();
}
项目:hadoop    文件:SimpleUdpServer.java   
public SimpleUdpServer(int port, SimpleChannelUpstreamHandler program,
    int workerCount) {
  this.port = port;
  this.rpcProgram = program;
  this.workerCount = workerCount;
}
项目:aliyun-oss-hadoop-fs    文件:SimpleUdpServer.java   
public SimpleUdpServer(int port, SimpleChannelUpstreamHandler program,
    int workerCount) {
  this.port = port;
  this.rpcProgram = program;
  this.workerCount = workerCount;
}
项目:nfs-rpc    文件:NettyClientPipelineFactory.java   
public NettyClientPipelineFactory(SimpleChannelUpstreamHandler handler) {
  this.handler = handler;
}
项目:big-c    文件:SimpleUdpServer.java   
public SimpleUdpServer(int port, SimpleChannelUpstreamHandler program,
    int workerCount) {
  this.port = port;
  this.rpcProgram = program;
  this.workerCount = workerCount;
}
项目:hadoop-2.6.0-cdh5.4.3    文件:SimpleUdpServer.java   
public SimpleUdpServer(int port, SimpleChannelUpstreamHandler program, int workerCount) {
  this.port = port;
  this.rpcProgram = program;
  this.workerCount = workerCount;
}
项目:hops    文件:SimpleUdpServer.java   
public SimpleUdpServer(int port, SimpleChannelUpstreamHandler program,
    int workerCount) {
  this.port = port;
  this.rpcProgram = program;
  this.workerCount = workerCount;
}
项目:migration-tool    文件:NettyClientPipelineFactory.java   
public NettyClientPipelineFactory(SimpleChannelUpstreamHandler handler){
    this.handler = handler;
}
项目:hadoop-TCP    文件:SimpleUdpServer.java   
public SimpleUdpServer(int port, SimpleChannelUpstreamHandler program, int workerCount) {
  this.port = port;
  this.rpcProgram = program;
  this.workerCount = workerCount;
}
项目:creeper    文件:CreeperSession.java   
public java.util.Optional<CreeperEntry<Merchant, SimpleChannelUpstreamHandler>> getGrabMerchant() {
    return grabMerchant;
}
项目:creeper    文件:CreeperSession.java   
public void setGrabMerchant(java.util.Optional<CreeperEntry<Merchant, SimpleChannelUpstreamHandler>> grabMerchant) {
    this.grabMerchant = grabMerchant;
}
项目:hardfs    文件:SimpleUdpServer.java   
public SimpleUdpServer(int port, SimpleChannelUpstreamHandler program, int workerCount) {
  this.port = port;
  this.rpcProgram = program;
  this.workerCount = workerCount;
}
项目:hadoop-on-lustre2    文件:SimpleUdpServer.java   
public SimpleUdpServer(int port, SimpleChannelUpstreamHandler program, int workerCount) {
  this.port = port;
  this.rpcProgram = program;
  this.workerCount = workerCount;
}