logger.debug("Connecting to Redis, address: " + redisAddress);
final Bootstrap redisBootstrap = new Bootstrap().channel(NioSocketChannel.class).group(eventLoopGroup);
redisBootstrap.option(ChannelOption.CONNECT_TIMEOUT_MILLIS, (int) unit.toMillis(timeout));
final ConnectionWatchdog watchdog = new ConnectionWatchdog(redisBootstrap, timer, socketAddressSupplier);
redisBootstrap.handler(new ChannelInitializer<Channel>() {
@Override
protected void initChannel(Channel ch) throws Exception {
if (withReconnect) {
watchdog.setReconnect(true);
ch.pipeline().addLast(watchdog);
}
ch.pipeline().addLast(new ChannelGroupListener(channels),
new ConnectionEventTrigger(connectionEvents, connection), handler, connection);