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. if(encryptionOptions.enabled) { bootstrap.handler(new SecureInitializer()); } else { bootstrap.handler(new Initializer()); } ChannelFuture future = bootstrap.connect(new InetSocketAddress(host, port)); // Wait until the connection attempt succeeds or fails. channel = future.awaitUninterruptibly().channel(); if (!future.isSuccess()) { bootstrap.group().shutdownGracefully(); throw new IOException("Connection Error", future.cause()); } }
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. if(encryptionOptions.enabled) { bootstrap.handler(new SecureInitializer()); } else { bootstrap.handler(new Initializer()); } ChannelFuture future = bootstrap.connect(new InetSocketAddress(host, port)); // Wait until the connection attempt succeeds or fails. channel = future.awaitUninterruptibly().channel(); if (!future.isSuccess()) { bootstrap.group().shutdownGracefully(); throw new IOException("Connection Error", future.cause()); } }
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. if(encryptionOptions.enabled) { bootstrap.handler(new SecureInitializer()); } else { bootstrap.handler(new Initializer()); } ChannelFuture future = bootstrap.connect(new InetSocketAddress(host, port)); // Wait until the connection attempt succeeds or fails. channel = future.awaitUninterruptibly().channel(); if (!future.isSuccess()) { bootstrap.group().shutdownGracefully(); throw new IOException("Connection Error", future.cause()); } }
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. if(encryptionOptions.enabled) { bootstrap.handler(new SecureInitializer()); } else { bootstrap.handler(new Initializer()); } ChannelFuture future = bootstrap.connect(new InetSocketAddress(host, port)); // Wait until the connection attempt succeeds or fails. channel = future.awaitUninterruptibly().channel(); if (!future.isSuccess()) { bootstrap.group().shutdownGracefully(); throw new IOException("Connection Error", future.cause()); } }