Package io.netty.channel

Examples of io.netty.channel.ChannelFuture.channel()


    ChannelFuture channelFuture = peerConnection.channelFuture();
    // channelCreator can be null if we don't need to create any channels
    if (channelCreator != null) {
      channelCreator.setupCloseListener(channelFuture, futureResponse);
    }
    ChannelPipeline pipeline = channelFuture.channel().pipeline();

    // we need to replace the handler if this comes from the peer that
    // create a peerConnection, otherwise we
    // need to add a handler
    addOrReplace(pipeline, "dispatcher", "handler", handler);
View Full Code Here


        }
      }
    });

    ChannelFuture future = b.bind(listenAddresses);
    channelsUDP.put(listenAddresses.getAddress(), future.channel());
    return handleFuture(future);
  }

  /**
   * Start to listen on a TCP port.
View Full Code Here

          }
        }
      }
    });
    ChannelFuture future = b.bind(listenAddresses);
    channelsTCP.put(listenAddresses.getAddress(), future.channel());
    return handleFuture(future);
  }

  private static <T> void bestEffortOptions(final Channel ch, ChannelOption<T> option, T value) {
    try {
View Full Code Here

      // Here we need to bind, as opposed to the TCP, were we connect if
      // we do a connect, we cannot receive
      // broadcast messages
      final ChannelFuture channelFuture = b.bind(new InetSocketAddress(channelClientConfiguration.senderUDP(), 0));

      recipients.add(channelFuture.channel());
      setupCloseListener(channelFuture, semaphoreUPD, futureResponse);
      return channelFuture;
        } finally {
      readUDP.unlock();
    }
View Full Code Here

      Map<String, Pair<EventExecutorGroup, ChannelHandler>> channelHandlers2 = channelClientConfiguration.pipelineFilter().filter(channelHandlers, true, true);
      addHandlers(b, channelHandlers2);

      ChannelFuture channelFuture = b.connect(socketAddress, new InetSocketAddress(channelClientConfiguration.senderTCP(), 0));

      recipients.add(channelFuture.channel());
      setupCloseListener(channelFuture, semaphoreTCP, futureResponse);
      return channelFuture;
    } finally {
      readTCP.unlock();
    }
View Full Code Here

        serverChannel = sb.bind(new InetSocketAddress(0)).sync().channel();
        int port = ((InetSocketAddress) serverChannel.localAddress()).getPort();

        ChannelFuture ccf = cb.connect(new InetSocketAddress(NetUtil.LOCALHOST, port));
        assertTrue(ccf.awaitUninterruptibly().isSuccess());
        clientChannel = ccf.channel();
    }

    @After
    public void teardown() throws Exception {
        cleanupCapturedRequests();
View Full Code Here

                                    new LoggingHandler(LogLevel.INFO),
                                    new ByteEchoPeerHandler(messageSize));
                        }
                    });
            final ChannelFuture future = bootstrap.connect(peerAddress, myAddress).sync();
            future.channel().closeFuture().sync();
        } finally {
            connectGroup.shutdownGracefully();
        }
    }
}
View Full Code Here

        serverChannel = sb.bind(new InetSocketAddress(0)).sync().channel();
        int port = ((InetSocketAddress) serverChannel.localAddress()).getPort();

        ChannelFuture ccf = cb.connect(new InetSocketAddress(NetUtil.LOCALHOST, port));
        assertTrue(ccf.awaitUninterruptibly().isSuccess());
        clientChannel = ccf.channel();

        assertTrue(latch.await(5, SECONDS));
    }

    private void awaitClient() throws Exception {
View Full Code Here

            bootstrap.bind().syncUninterruptibly();
            Assert.fail();
        } catch (Exception e) {
            Assert.assertTrue(e instanceof IOException);
        }
        future.channel().close().syncUninterruptibly();
    }

    @Test(timeout = 10000)
    public void testMultipleBindSocketChannel() throws Exception {
        Assume.assumeTrue(versionEqOrGt(3, 9, 0));
View Full Code Here

        ServerBootstrap bootstrap = createServerBootstrap();
        bootstrap.option(EpollChannelOption.SO_REUSEPORT, true);
        final AtomicBoolean accepted1 = new AtomicBoolean();
        bootstrap.childHandler(new ServerSocketTestHandler(accepted1));
        ChannelFuture future = bootstrap.bind().syncUninterruptibly();
        InetSocketAddress address1 = (InetSocketAddress) future.channel().localAddress();

        final AtomicBoolean accepted2 = new AtomicBoolean();
        bootstrap.childHandler(new ServerSocketTestHandler(accepted2));
        ChannelFuture future2 = bootstrap.bind().syncUninterruptibly();
        InetSocketAddress address2 = (InetSocketAddress) future2.channel().localAddress();
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.