code: public static void closeConnection( Channel channel ) throws IOException {
  
  		if( channel != null ) {
  			if( channel.isOpen())
  				channel.close();
  
  			if( channel.getConnection().isOpen())
  				channel.getConnection().close();
  		}
  	}
docs: Closes the connection to a channel.
  @param channel the channel to close (can be null)
  @throws IOException if something went wrong