code: public Channel connect(final ChannelPipelineFactory pipelineFactory,
  			final Event loginEvent, int timeout, TimeUnit unit)
  			throws InterruptedException
  	{
  		ChannelFuture future;
  		synchronized (bootstrap)
  		{
  			bootstrap.setPipelineFactory(pipelineFactory);
  			future = bootstrap.connect(serverAddress);
  			future.addListener(new ChannelFutureListener()
  			{
  				@Override
  				public void operationComplete(ChannelFuture future)
  						throws Exception
  				{
  					if (future.isSuccess())
  					{
  						future.getChannel().write(loginEvent);
  					}
  					else
  					{
  						throw new RuntimeException(future.getCause()
  								.getMessage());
  					}
  				}
  			});
  		}
  		return future.getChannel();
  	}
docs: Method that is used to create the connection or {@link Channel} to
  communicated with the remote jetserver.
  
  @param pipelineFactory
  The factory used to create a pipeline of decoders and encoders
  for each {@link Channel} that it creates on connection.
  @param loginEvent
  The event contains the {@link ChannelBuffer} to be transmitted
  to jetserver for logging in. Values inside this buffer include
  username, password, connection key, <b>optional</b> local
  address of the UDP channel used by this session.
  @param timeout
  The amount of time to wait for this connection be created
  successfully.
  @param unit
  The unit of timeout SECONDS, MILLISECONDS etc. Default is 5
  seconds.
  @return Returns the Netty {@link Channel} which is the connection to the
  remote jetserver.
  @throws InterruptedException