Package org.jboss.netty.channel

Examples of org.jboss.netty.channel.SimpleChannelUpstreamHandler


      public ChannelPipeline getPipeline() throws Exception {
        return Channels.pipeline(
            new ExecutionHandler(executor),
            new ZMTP20Codec(new ZMTPSession(ZMTPConnectionType.Addressed, 1024, identity.getBytes(),
                                            ZMTPSocketType.REQ), false),
            new SimpleChannelUpstreamHandler() {

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


          }

          @Override
          public void onMsg(Map<String, String> msg) {
          }},
            new SimpleChannelUpstreamHandler());
    }
View Full Code Here

          }

          @Override
          public void onMsg(Map<String, String> msg) {
          }},
          new SimpleChannelUpstreamHandler());
    }
View Full Code Here

    /**
     * Send the WebSocketFrame and call the FrameListener once a frame was received as response or
     * when an Exception was caught.
     */
    public WebSocketTestClient send(WebSocketFrame frame, final FrameListener listener) {
        ch.getPipeline().addLast("responseHandler" + count.incrementAndGet(), new SimpleChannelUpstreamHandler() {
            @Override
            public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) throws Exception {
                if (e.getMessage() instanceof CloseWebSocketFrame) {
                    closed = true;
                }
View Full Code Here

        DatagramChannel cc = null;
        try {
            MulticastTestHandler mhandler = new MulticastTestHandler();

            cb.getPipeline().addFirst("handler", mhandler);
            sb.getPipeline().addFirst("handler", new SimpleChannelUpstreamHandler());

            int port = TestUtil.getFreePort();

            NetworkInterface loopbackIf;
            try {
View Full Code Here

        sb.setPipelineFactory(new ChannelPipelineFactory() {
            public ChannelPipeline getPipeline() throws Exception {
                ChannelPipeline cp = Channels.pipeline();

                cp.addFirst("counter", new SimpleChannelUpstreamHandler() {
                    @Override
                    public void channelConnected(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception {
                        ctx.getPipeline().get(SslHandler.class).handshake().addListener(new ChannelFutureListener() {
                            public void operationComplete(ChannelFuture future) throws Exception {
                                if (!future.isSuccess()) {
View Full Code Here

                newServerSocketChannelFactory(Executors.newCachedThreadPool()));
        ConnectionlessBootstrap cb = new ConnectionlessBootstrap(
                newClientSocketChannelFactory(Executors.newCachedThreadPool()));

        final CountDownLatch latch = new CountDownLatch(1);
        sb.getPipeline().addFirst("handler", new SimpleChannelUpstreamHandler() {

            @Override
            public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) throws Exception {
                super.messageReceived(ctx, e);
                assertEquals(1, ((ChannelBuffer) e.getMessage()).readInt());

                latch.countDown();
            }

        });
        cb.getPipeline().addFirst("handler", new SimpleChannelUpstreamHandler());

        Channel sc = sb.bind(new InetSocketAddress("127.0.0.1",0));

        Channel cc = cb.bind(new InetSocketAddress("127.0.0.1", 0));
        ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
View Full Code Here

        SSLEngine sse = SecureChatSslContextFactory.getServerContext().createSSLEngine();
        sse.setUseClientMode(false);

        sb.getPipeline().addFirst("ssl", new SslHandler(sse));
        sb.getPipeline().addLast("handler", new SimpleChannelUpstreamHandler() {

            @Override
            public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e) throws Exception {
                e.getCause().printStackTrace();
                System.out.println("Close channel");
View Full Code Here

                                                                      workerExecutor, workerThreadPoolSize));
    bootstrap.setOptions(channelConfigs);

    resourceHandler.init(handlerContext);

    final ChannelUpstreamHandler connectionTracker = new SimpleChannelUpstreamHandler() {
      @Override
      public void handleUpstream(ChannelHandlerContext ctx, ChannelEvent e) throws Exception {
        channelGroup.add(e.getChannel());
        super.handleUpstream(ctx, e);
      }
View Full Code Here

            pipeline.addLast("executor", new ExecutionHandler(executor));
        pipeline.addLast("logging", new LoggingHandler(logger));
        // a node resolver must be added before the mesage codec
        pipeline.addLast("messageCodec", new MessageCodec());
        pipeline.addLast("nodeResolver", nodeResolver);
        pipeline.addLast("common", new SimpleChannelUpstreamHandler() {

            @Override
            public void channelConnected(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception {
                if (channelGroup != null)
                    channelGroup.add(e.getChannel());
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.