title: How to make a client connect to multiple host with the same client bootstrap in netty 4?
body: <p>In this code When the client connects to a new Server the previously connected channel with the server gets inactive and that channel gets allocated to the newly connected server. I want a way to store all the channels this can be done by allocating a  separate channel for each connected server.</p>
  
  <pre><code>EventLoopGroup workerGroup = new NioEventLoopGroup();
  try {
      Bootstrap client = new Bootstrap();
      client.group(workerGroup);
      client.channel(NioSocketChannel.class);
      client.handler(new ChannelInitializer&lt;SocketChannel&gt;() {
      @Override
       public void initChannel(SocketChannel ch) throws Exception {
                  ch.pipeline().addLast(new ObjectEncoder(),new ObjectDecoder(ClassResolvers.weakCachingResolver(Message.class.getClassLoader())),new ClientHandler());
              }
       });
       Thread.sleep(10000);
  
       ChannelFuture future = client.connect("localhost", destination_Port).sync();
       if(future.isSuccess()) {
           System.out.println("Connected to node " +destination_Node + " port is "+ destination_Port);
           // Storing the channel in the map to reuse later
           channelMap.put(destination_Node,future);
       }
       // data is an object which will be sent to the server 
       data.setSender(nodeID);
       data.setClockTime(clockTime);
       future.channel().writeAndFlush(data);
  }
  finally {
       workerGroup.shutdownGracefully();
  }
  </code></pre>
  
  <p>From the sources i went through i understand that with the help of a ChannelFactory i will be able to have a separate channel for each connected host but i was not able to implement it can someone help me with this? </p>