Package io.netty.channel.socket.nio

Examples of io.netty.channel.socket.nio.NioSocketChannel.pipeline()


    public TCPWrap(NodeProcess process, int fd) throws Exception {
        super(process, false);
        SocketChannel socketChannel = UnsafeTcp.attach(fd);
        NioSocketChannel channel = new NioSocketChannel(socketChannel);
        this.channelFuture = channel.newSucceededFuture();
        channel.pipeline().addLast("emit.afterConnect", new AfterConnectEventHandler(this.process, TCPWrap.this));
        channel.pipeline().addLast("emit.eof", new EOFEventHandler(this.process, TCPWrap.this));
        channel.pipeline().addLast("handle", new UnrefHandler(this));
        process.getEventLoop().getEventLoopGroup().register(channel);
    }
View Full Code Here


        super(process, false);
        SocketChannel socketChannel = UnsafeTcp.attach(fd);
        NioSocketChannel channel = new NioSocketChannel(socketChannel);
        this.channelFuture = channel.newSucceededFuture();
        channel.pipeline().addLast("emit.afterConnect", new AfterConnectEventHandler(this.process, TCPWrap.this));
        channel.pipeline().addLast("emit.eof", new EOFEventHandler(this.process, TCPWrap.this));
        channel.pipeline().addLast("handle", new UnrefHandler(this));
        process.getEventLoop().getEventLoopGroup().register(channel);
    }

    public TCPWrap(NodeProcess process, ChannelFuture channelFuture) {
View Full Code Here

        SocketChannel socketChannel = UnsafeTcp.attach(fd);
        NioSocketChannel channel = new NioSocketChannel(socketChannel);
        this.channelFuture = channel.newSucceededFuture();
        channel.pipeline().addLast("emit.afterConnect", new AfterConnectEventHandler(this.process, TCPWrap.this));
        channel.pipeline().addLast("emit.eof", new EOFEventHandler(this.process, TCPWrap.this));
        channel.pipeline().addLast("handle", new UnrefHandler(this));
        process.getEventLoop().getEventLoopGroup().register(channel);
    }

    public TCPWrap(NodeProcess process, ChannelFuture channelFuture) {
        super(process, channelFuture);
View Full Code Here

  public static void main(String[] args) throws Exception {
    final SocketChannel ch = new NioSocketChannel();
    new NioEventLoopGroup().register(ch);
    final long start = System.currentTimeMillis();
    ch.pipeline().addLast(new RedisCommandEncoder(), new RedisReplyDecoder());
    ch.connect(new InetSocketAddress("localhost", 6379)).addListener(new ChannelFutureListener() {
      @Override
      public void operationComplete(ChannelFuture channelFuture) throws Exception {
        write(ch);
      }
View Full Code Here

  public static Promise<RedisClientBase> connect(String host, int port) {
    final Queue<Promise<Reply>> queue = new LinkedList<>();
    SocketChannel socketChannel = new NioSocketChannel();
    final RedisClientBase client = new RedisClientBase(socketChannel, queue);
    socketChannel.pipeline().addLast(new RedisCommandEncoder(), new RedisReplyDecoder(),
            new SimpleChannelInboundHandler<Reply<?>>() {
              @Override
              protected void channelRead0(ChannelHandlerContext channelHandlerContext, Reply<?> reply) throws Exception {
                Promise<Reply> poll;
                synchronized (client) {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.