Example usage for io.netty.channel ChannelHandlerContext read

List of usage examples for io.netty.channel ChannelHandlerContext read

Introduction

In this page you can find the example usage for io.netty.channel ChannelHandlerContext read.

Prototype

@Override
    ChannelHandlerContext read();

Source Link

Usage

From source file:org.opendaylight.controller.netconf.util.handler.ssh.virtualsocket.ChannelOutputStream.java

License:Open Source License

public void read(ChannelHandlerContext ctx) throws Exception {
    ctx.read();
}

From source file:org.z.core.test.HexDumpProxyBackendHandler.java

License:Apache License

public void channelActive(ChannelHandlerContext ctx) {
    ctx.read();
    ctx.write(Unpooled.EMPTY_BUFFER);
}

From source file:reactor.io.net.impl.netty.http.NettyHttpServerHandler.java

License:Open Source License

@Override
public void channelActive(ChannelHandlerContext ctx) throws Exception {
    ctx.fireChannelActive();
    ctx.read();
}

From source file:reactor.io.net.impl.netty.http.NettyHttpWSClientHandler.java

License:Open Source License

@Override
public void channelActive(final ChannelHandlerContext ctx) throws Exception {
    handshaker.handshake(ctx.channel()).addListener(new ChannelFutureListener() {
        @Override/*from   www  . j a va2 s. co  m*/
        public void operationComplete(ChannelFuture future) throws Exception {
            ctx.read();
        }
    });
}

From source file:reactor.io.net.impl.netty.NettyChannelHandlerBridge.java

License:Apache License

@Override
public void userEventTriggered(final ChannelHandlerContext ctx, Object evt) throws Exception {
    if (evt != null && evt.getClass().equals(ChannelInputSubscriberEvent.class)) {

        if (null == channelSubscription) {

            @SuppressWarnings("unchecked")
            ChannelInputSubscriberEvent<IN> subscriberEvent = (ChannelInputSubscriberEvent<IN>) evt;

            this.channelSubscription = new PushSubscription<IN>(null, subscriberEvent.inputSubscriber) {
                @Override/*from w ww  .  ja v  a 2 s. c o  m*/
                protected void onRequest(long n) {
                    if (n == Long.MAX_VALUE) {
                        ctx.channel().config().setAutoRead(true);
                    }
                    ctx.read();
                }

                /*   @Override
                   public void cancel() {
                      super.cancel();
                      if (ctx.channel().isOpen()) {
                         ctx.close();
                      }
                   }*/
            };
            subscriberEvent.inputSubscriber.onSubscribe(channelSubscription);

        } else {
            channelSubscription
                    .onError(new IllegalStateException("Only one connection input subscriber allowed."));
        }
    }
    super.userEventTriggered(ctx, evt);
}

From source file:reactor.io.net.impl.netty.NettyChannelHandlerBridge.java

License:Apache License

@Override
public void channelReadComplete(ChannelHandlerContext ctx) throws Exception {
    if (this.channelSubscription == null) {
        return;/*from  w w  w . ja  v  a2  s. com*/
    }

    try {
        super.channelReadComplete(ctx);
        if (channelSubscription.pendingRequestSignals() != Long.MAX_VALUE) {
            channelSubscription.updatePendingRequests(-1);
            if (channelSubscription.pendingRequestSignals() > 0l) {
                ctx.read();
            }
        }
    } catch (Throwable throwable) {
        if (channelSubscription != null) {
            channelSubscription.onError(throwable);
        } else if (Environment.alive()) {
            Environment.get().routeError(throwable);
        }
    }
}

From source file:reactor.io.net.impl.netty.NettyNetChannelInboundHandler.java

License:Apache License

@Override
public void channelActive(final ChannelHandlerContext ctx) throws Exception {
    try {//from  w w w . j a va  2 s .c  o  m
        if (this.channelSubscription != null) {
            super.channelActive(ctx);
            if (log.isDebugEnabled()) {
                log.debug("RESUME: " + ctx.channel());
            }
            return;
        }

        this.channelSubscription = new PushSubscription<IN>(null, subscriber) {
            @Override
            protected void onRequest(long n) {
                if (n == Long.MAX_VALUE) {
                    ctx.channel().config().setAutoRead(true);
                }
                ctx.read();
            }

            @Override
            public void cancel() {
                super.cancel();
                if (ctx.channel().isOpen()) {
                    ctx.close();
                }
            }
        };
        channelStream.registerOnPeer();
        subscriber.onSubscribe(channelSubscription);
        super.channelActive(ctx);
    } catch (Throwable err) {
        subscriber.onError(err);
    }
}

From source file:reactor.io.net.impl.netty.NettyNetChannelInboundHandler.java

License:Apache License

@Override
public void channelReadComplete(ChannelHandlerContext ctx) throws Exception {
    if (channelSubscription.isComplete()) {
        return;/* w w  w  . j  a  va  2 s. c  o m*/
    }

    try {
        super.channelReadComplete(ctx);
        if (channelSubscription.pendingRequestSignals() != Long.MAX_VALUE
                && channelSubscription.pendingRequestSignals() > 1l) {
            ctx.read();
        }
    } catch (Throwable throwable) {
        channelSubscription.onError(throwable);
    }
}

From source file:reactor.ipc.netty.channel.SslReadHandler.java

License:Open Source License

@Override
public void channelActive(ChannelHandlerContext ctx) throws Exception {
    ctx.read(); //consume handshake
    //super.channelActive(ctx);
}

From source file:reactor.ipc.netty.channel.SslReadHandler.java

License:Open Source License

@Override
public void channelReadComplete(ChannelHandlerContext ctx) throws Exception {
    if (!handshakeDone) {
        ctx.read(); /* continue consuming. */
    }/*from  w w  w . j a va  2s  .c  o  m*/
    super.channelReadComplete(ctx);
}