code: void establishConnection () throws IOException {
          synchronized (operationOnConnectionMonitor) {
              if (state == State.CLOSED) {
                  throw new IOException("Attempt to establish a connection with a closed connection factory");
              } else if (state == State.CONNECTED) {
                  LOGGER.warn("Establishing new connection although a connection is already established");
              }
              try {
                  LOGGER.info("Trying to establish connection to {}:{}", getHost(), getPort());
                  connection = super.newConnection(executorService);
                  connection.addShutdownListener(connectionShutdownListener);
                  LOGGER.info("Established connection to {}:{}", getHost(), getPort());
                  changeState(State.CONNECTED);
              } catch (IOException e) {
                  LOGGER.error("Failed to establish connection to {}:{}", getHost(), getPort());
                  throw e;
              }
          }
      }
docs: Establishes a new connection.
  
  @throws IOException if establishing a new connection fails