/**
   * User triggered attempt to reconnect
   *
   * @throws MqttException
   */
  public void reconnect() throws MqttException {
    final String methodName = "reconnect";
    // @Trace 500=Attempting to reconnect client: {0}
    log.fine(CLASS_NAME, methodName, "500", new Object[] {this.clientId});
    // Some checks to make sure that we're not attempting to reconnect an already connected client
    if (comms.isConnected()) {
      throw ExceptionHelper.createMqttException(MqttException.REASON_CODE_CLIENT_CONNECTED);
    }
    if (comms.isConnecting()) {
      throw new MqttException(MqttException.REASON_CODE_CONNECT_IN_PROGRESS);
    }
    if (comms.isDisconnecting()) {
      throw new MqttException(MqttException.REASON_CODE_CLIENT_DISCONNECTING);
    }
    if (comms.isClosed()) {
      throw new MqttException(MqttException.REASON_CODE_CLIENT_CLOSED);
    }
    // We don't want to spam the server
    stopReconnectCycle();

    attemptReconnect();
  }