code: ChannelFuture connect(final InetSocketAddress serverSocketAddress) {
  		checkState(bootstrap != null, "Client has not been initialized yet.");
  
  		// --------------------------------------------------------------------
  		// Child channel pipeline for accepted connections
  		// --------------------------------------------------------------------
  
  		bootstrap.handler(new ChannelInitializer<SocketChannel>() {
  			@Override
  			public void initChannel(SocketChannel channel) throws Exception {
  
  				// SSL handler should be added first in the pipeline
  				if (clientSSLFactory != null) {
  					SslHandler sslHandler = clientSSLFactory.createNettySSLHandler(
  							serverSocketAddress.getAddress().getCanonicalHostName(),
  							serverSocketAddress.getPort());
  					channel.pipeline().addLast("ssl", sslHandler);
  				}
  				channel.pipeline().addLast(protocol.getClientChannelHandlers());
  			}
  		});
  
  		try {
  			return bootstrap.connect(serverSocketAddress);
  		}
  		catch (ChannelException e) {
  			if ((e.getCause() instanceof java.net.SocketException &&
  					e.getCause().getMessage().equals("Too many open files")) ||
  				(e.getCause() instanceof ChannelException &&
  						e.getCause().getCause() instanceof java.net.SocketException &&
  						e.getCause().getCause().getMessage().equals("Too many open files")))
  			{
  				throw new ChannelException(
  						"The operating system does not offer enough file handles to open the network connection. " +
  								"Please increase the number of available file handles.", e.getCause());
  			}
  			else {
  				throw e;
  			}
  		}
  	}
docs: ------------------------------------------------------------------------