Package org.jboss.netty.channel

Examples of org.jboss.netty.channel.SimpleChannelUpstreamHandler


            logger.warn("Failed to connect " + remote);
          }
        }
      });
      proxyTunnel.getChannel().getPipeline()
              .addLast("Forward", new SimpleChannelUpstreamHandler()
              {
                public void channelClosed(ChannelHandlerContext ctx,
                        ChannelStateEvent e) throws Exception
                {
                  doClose();
View Full Code Here


            }
          }
        });
      }
      proxyTunnel.getChannel().getPipeline()
              .addLast("Forward", new SimpleChannelUpstreamHandler()
              {
                public void channelClosed(ChannelHandlerContext ctx,
                        ChannelStateEvent e) throws Exception
                {
                  doClose();
View Full Code Here

        @Override
        public ChannelPipeline getPipeline() throws Exception
        {
          ChannelPipeline p = Channels.pipeline();
          p.addLast("empty", new SimpleChannelUpstreamHandler());
          return p;
        }
      });
    }
    return clientBootstrap;
View Full Code Here

          // Store all connected channels in order to ensure that we can close
          // them on stop(), or else stop() may hang waiting for the
          // connections to close on their own
          pipeline.addLast("connectedChannels",
              new SimpleChannelUpstreamHandler() {
                @Override
                public void channelConnected(ChannelHandlerContext ctx,
                    ChannelStateEvent e) throws Exception {
                  super.channelConnected(ctx, e);
                  accepted.add(e.getChannel());
View Full Code Here

  }

  public static <T extends RedisClientBase> Promise<T> connect(String hostname, int port, final T redisClient, final ExecutorService executor) {
    final ClientBootstrap cb = new ClientBootstrap(new NioClientSocketChannelFactory(executor, executor));
    final Queue<Promise> queue = new LinkedTransferQueue<>();
    final SimpleChannelUpstreamHandler handler = new SimpleChannelUpstreamHandler() {
      @Override
      public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) throws Exception {
        Object message = e.getMessage();
        if (queue.isEmpty()) {
          if (message instanceof MultiBulkReply) {
View Full Code Here

        ClientBootstrap bootstrap = new ClientBootstrap(factory);
        bootstrap.setOption("sendBufferSize", 64 * 1024);
        bootstrap.setOption("tcpNoDelay", true);
        bootstrap.setPipelineFactory(new ChannelPipelineFactory() {
            public ChannelPipeline getPipeline() throws Exception {
                return Channels.pipeline(new SimpleChannelUpstreamHandler() {
                    private void sendMessage(ChannelHandlerContext ctx, byte[] data) {
                        ChannelBuffer buffer = ChannelBuffers.wrappedBuffer(data);
                        ctx.getChannel().write(buffer);
                    }

View Full Code Here

        ServerBootstrap bootstrap = new ServerBootstrap(factory);
        bootstrap.setOption("receiveBufferSize", 128 * 1024);
        bootstrap.setOption("tcpNoDelay", true);
        bootstrap.setPipelineFactory(new ChannelPipelineFactory() {
            public ChannelPipeline getPipeline() throws Exception {
                return Channels.pipeline(new SimpleChannelUpstreamHandler() {
                    @Override
                    public void childChannelOpen(ChannelHandlerContext ctx, ChildChannelStateEvent e) throws Exception {
                        System.out.println("childChannelOpen");
                        setAttribute(ctx, STATE_ATTRIBUTE, State.WAIT_FOR_FIRST_BYTE_LENGTH);
                    }
View Full Code Here

      public ChannelPipeline getPipeline() throws Exception {

        return Channels.pipeline(
            new ExecutionHandler(executor),
            new ZMTP10Codec(new ZMTPSession(ZMTPConnectionType.Addressed, identity.getBytes())),
            new SimpleChannelUpstreamHandler() {

              @Override
              public void channelConnected(final ChannelHandlerContext ctx,
                                           final ChannelStateEvent e) throws Exception {
                mockHandler.channelConnected(ctx, e);
View Full Code Here

    final ClientBootstrap clientBootstrap =
        new ClientBootstrap(new NioClientSocketChannelFactory());
    clientBootstrap.setPipelineFactory(new ChannelPipelineFactory() {
      @Override
      public ChannelPipeline getPipeline() throws Exception {
        return Channels.pipeline(new SimpleChannelUpstreamHandler());
      }
    });
    final ChannelFuture future = clientBootstrap.connect(serverAddress);
    future.awaitUninterruptibly();
View Full Code Here

   * First let's just exercise the PipelineTester a bit.
   */
  @Test
  public void testPipelineTester() {
    final ChannelBuffer buf = ChannelBuffers.wrappedBuffer("Hello, world".getBytes());
    ChannelPipeline pipeline = Channels.pipeline(new SimpleChannelUpstreamHandler() {

      @Override
      public void channelConnected(ChannelHandlerContext ctx, ChannelStateEvent e)
          throws Exception {
        e.getChannel().write(buf);
View Full Code Here

TOP

Related Classes of org.jboss.netty.channel.SimpleChannelUpstreamHandler

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.