Package io.netty.bootstrap

Examples of io.netty.bootstrap.Bootstrap


        server = RxNetty.createTcpServer(0, PipelineConfigurators.textOnlyConfigurator(),
                                         serverConnHandler).start();
        serverInfo = new RxClient.ServerInfo("localhost", server.getServerPort());
        metricEventsListener = new TrackableMetricEventsListener();
        strategy = new MaxConnectionsBasedStrategy(1);
        clientBootstrap = new Bootstrap().group(new NioEventLoopGroup(4))
                                         .channel(NioSocketChannel.class);
        pipelineConfigurator = new PipelineConfiguratorComposite<String, String>(
                PipelineConfigurators.textOnlyConfigurator(), new PipelineConfigurator() {
            @Override
            public void configureNewPipeline(ChannelPipeline pipeline) {
View Full Code Here


     * @param remoteId remote connection Id
     * @throws IOException
     */
    public Connection(ConnectionId remoteId) throws IOException {
      group = new NioEventLoopGroup();
      bootstrap = new Bootstrap();
      this.remoteId = remoteId;
      this.serverAddress = remoteId.getAddress();
      if (serverAddress.isUnresolved()) {
        throw new UnknownHostException("unknown host: "
            + remoteId.getAddress().getHostName());
View Full Code Here

          // Configure the client.
          // NioEventLoopGroup is a multithreaded event loop that handles I/O
          // operation
          group = new NioEventLoopGroup();
          // Bootstrap is a helper class that sets up a client
          bootstrap = new Bootstrap();
          bootstrap.group(group).channel(NioSocketChannel.class)
              .option(ChannelOption.TCP_NODELAY, this.tcpNoDelay)
              .option(ChannelOption.SO_KEEPALIVE, true)
              .option(ChannelOption.CONNECT_TIMEOUT_MILLIS, pingInterval)
              .option(ChannelOption.SO_SNDBUF, 30 * 1024 * 1024)
 
View Full Code Here

    }

    protected void establishConnection() throws IOException
    {
        // Configure the client.
        bootstrap = new Bootstrap()
                    .group(new NioEventLoopGroup())
                    .channel(io.netty.channel.socket.nio.NioSocketChannel.class)
                    .option(ChannelOption.TCP_NODELAY, true);

        // Configure the pipeline factory.
View Full Code Here

   
    public NettyHttpConduit(Bus b, EndpointInfo ei, EndpointReferenceType t, NettyHttpConduitFactory conduitFactory)
        throws IOException {
        super(b, ei, t);
        factory = conduitFactory;
        bootstrap = new Bootstrap();
        EventLoopGroup eventLoopGroup = bus.getExtension(EventLoopGroup.class);
        bootstrap.group(eventLoopGroup);
        bootstrap.channel(NioSocketChannel.class);
    }
View Full Code Here

        DiskFileUpload.baseDirectory = null; // system temp directory
        DiskAttribute.deleteOnExitTemporaryFile = true; // should delete file on exit (in normal exit)
        DiskAttribute.baseDirectory = null; // system temp directory

        try {
            Bootstrap b = new Bootstrap();
            b.group(group).channel(NioSocketChannel.class).handler(new HttpUploadClientIntializer(sslCtx));

            // Simple Get form: no factory used (not usable)
            List<Entry<String, String>> headers = formget(b, host, port, get, uriSimple);
            if (headers == null) {
                factory.cleanAllHttpDatas();
View Full Code Here

    private void initialize() throws Exception {
        EventLoopGroup workerGroup = new NioEventLoopGroup();
        NodeInfo[] serverNodes = router.getAllNodes();
        for(NodeInfo node : serverNodes) {
            Bootstrap b = new Bootstrap();
            configureBootstrap(b, workerGroup, node);
        }
        this.workers = workerGroup;
        this.initialized = true;
    }
View Full Code Here

                              new LoggingHandler(LogLevel.INFO),
                              new LocalEchoServerHandler());
                  }
              });

            Bootstrap cb = new Bootstrap();
            cb.group(clientGroup)
              .channel(LocalChannel.class)
              .handler(new ChannelInitializer<LocalChannel>() {
                  @Override
                  public void initChannel(LocalChannel ch) throws Exception {
                      ch.pipeline().addLast(
                              new LoggingHandler(LogLevel.INFO),
                              new LocalEchoClientHandler());
                  }
              });

            // Start the server.
            sb.bind(addr).sync();

            // Start the client.
            Channel ch = cb.connect(addr).sync().channel();

            // Read commands from the stdin.
            System.out.println("Enter text (quit to end)");
            ChannelFuture lastWriteFuture = null;
            BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
View Full Code Here

        Thread thread = new Thread("UDP Network Listener") {
            public void run() {
                try {
                    EventLoopGroup group = new NioEventLoopGroup();
                    try {
                        Bootstrap bootstrap = new Bootstrap()
                                .group(group)
                                .channel(NioDatagramChannel.class)
                                .handler(UdpListenerService.this);
                       
                        // remember folks, this is blocking.
                        log.info(String.format("Binding to %s", addr.toString()));
                        bootstrap.bind(addr).sync().channel().closeFuture().await();
                       
                    } finally {
                        group.shutdownGracefully();
                        running.set(false);
                    }
View Full Code Here

        log.info("Sending metrics for {} starting {}", locator, System.currentTimeMillis());

        try {

            // netty UDP boilerplate.
            Bootstrap bootstrap = new Bootstrap()
                    .group(group)
                    .channel(NioDatagramChannel.class)
                    .handler(new SimpleChannelInboundHandler<DatagramPacket>() {
                        @Override
                        protected void channelRead0(ChannelHandlerContext ctx, DatagramPacket msg) throws Exception {
                            System.err.println("SHOULD NOT BE GETTING MESSAGES");
                        }
                    });

            final Channel ch = bootstrap.bind(0).sync().channel();

            // we'll send the datagrams using a timer.
            TimerTask task = new TimerTask() {
                @Override
                public void run() {
View Full Code Here

TOP

Related Classes of io.netty.bootstrap.Bootstrap

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.