Package io.netty.bootstrap

Examples of io.netty.bootstrap.ServerBootstrap.option()


            b.group(bossGroup, workerGroup);
            b.channel(NioServerSocketChannel.class);
           
            b.option(ChannelOption.SO_KEEPALIVE, true);
            b.option(ChannelOption.MESSAGE_SIZE_ESTIMATOR, DefaultMessageSizeEstimator.DEFAULT);
            b.option(ChannelOption.CONNECT_TIMEOUT_MILLIS, CONFIG.peerConnectionTimeout());

            b.handler(new LoggingHandler());
            b.childHandler(ethereumChannelInitializer);

            // Start the client.
View Full Code Here


    final WorkerConf conf = WorkerConf.get();
    ServerBootstrap boot = new ServerBootstrap();
    boot = setupGroups(boot, conf.NETTY_CHANNEL_TYPE);

    // use pooled buffers
    boot.option(ChannelOption.ALLOCATOR, PooledByteBufAllocator.DEFAULT);
    boot.childOption(ChannelOption.ALLOCATOR, PooledByteBufAllocator.DEFAULT);

    // set write buffer
    // this is the default, but its recommended to set it in case of change in future netty.
    boot.childOption(ChannelOption.WRITE_BUFFER_HIGH_WATER_MARK, conf.NETTY_HIGH_WATER_MARK);
View Full Code Here

    boot.childOption(ChannelOption.WRITE_BUFFER_HIGH_WATER_MARK, conf.NETTY_HIGH_WATER_MARK);
    boot.childOption(ChannelOption.WRITE_BUFFER_LOW_WATER_MARK, conf.NETTY_LOW_WATER_MARK);

    // more buffer settings
    if (conf.NETTY_BACKLOG.isPresent()) {
      boot.option(ChannelOption.SO_BACKLOG, conf.NETTY_BACKLOG.get());
    }
    if (conf.NETTY_SEND_BUFFER.isPresent()) {
      boot.option(ChannelOption.SO_SNDBUF, conf.NETTY_SEND_BUFFER.get());
    }
    if (conf.NETTY_RECIEVE_BUFFER.isPresent()) {
View Full Code Here

    // more buffer settings
    if (conf.NETTY_BACKLOG.isPresent()) {
      boot.option(ChannelOption.SO_BACKLOG, conf.NETTY_BACKLOG.get());
    }
    if (conf.NETTY_SEND_BUFFER.isPresent()) {
      boot.option(ChannelOption.SO_SNDBUF, conf.NETTY_SEND_BUFFER.get());
    }
    if (conf.NETTY_RECIEVE_BUFFER.isPresent()) {
      boot.option(ChannelOption.SO_RCVBUF, conf.NETTY_RECIEVE_BUFFER.get());
    }
    return boot;
View Full Code Here

    }
    if (conf.NETTY_SEND_BUFFER.isPresent()) {
      boot.option(ChannelOption.SO_SNDBUF, conf.NETTY_SEND_BUFFER.get());
    }
    if (conf.NETTY_RECIEVE_BUFFER.isPresent()) {
      boot.option(ChannelOption.SO_RCVBUF, conf.NETTY_RECIEVE_BUFFER.get());
    }
    return boot;
  }

  private ThreadFactory createThreadFactory(final String nameFormat) {
View Full Code Here

        // Configure the server.
        EventLoopGroup bossGroup = new NioEventLoopGroup();
        EventLoopGroup workerGroup = new NioEventLoopGroup();
        try {
            ServerBootstrap b = new ServerBootstrap();
            b.option(ChannelOption.SO_BACKLOG, 1024);
            b.group(bossGroup, workerGroup)
             .channel(NioServerSocketChannel.class)
             .handler(new LoggingHandler(LogLevel.INFO))
             .childHandler(new HttpServerInitializer(sslCtx, JSON_FILE));
View Full Code Here

    public CubeServer start() {
        workerGroup = new NioEventLoopGroup(8);

        try {
            final ServerBootstrap bootstrap = new ServerBootstrap();
            bootstrap
                .option(ChannelOption.SO_REUSEADDR, true)
                .option(ChannelOption.SO_SNDBUF, 1024)
                .option(ChannelOption.TCP_NODELAY, true)
                .group(workerGroup)
                .channel(NioServerSocketChannel.class)
View Full Code Here

    @Test(timeout = 10000)
    public void testMultipleBindSocketChannel() throws Exception {
        Assume.assumeTrue(versionEqOrGt(3, 9, 0));
        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();
View Full Code Here

        // Configure the server.
        EventLoopGroup bossGroup = new NioEventLoopGroup(1);
        EventLoopGroup workerGroup = new NioEventLoopGroup();
        try {
            ServerBootstrap b = new ServerBootstrap();
            b.option(ChannelOption.SO_BACKLOG, 1024);
            b.group(bossGroup, workerGroup)
             .channel(NioServerSocketChannel.class)
             .handler(new LoggingHandler(LogLevel.INFO))
             .childHandler(new SpdyServerInitializer(sslCtx));
View Full Code Here

        // Configure the server.
        EventLoopGroup bossGroup = new NioEventLoopGroup(1);
        EventLoopGroup workerGroup = new NioEventLoopGroup();
        try {
            ServerBootstrap b = new ServerBootstrap();
            b.option(ChannelOption.SO_BACKLOG, 1024);
            b.group(bossGroup, workerGroup)
             .channel(NioServerSocketChannel.class)
             .handler(new LoggingHandler(LogLevel.INFO))
             .childHandler(new Http2ServerInitializer(sslCtx));
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.