@Override
  public void handleFailureComponentRegistrationNotificationEvent(
      PlatformComponentProfile networkServiceApplicant,
      PlatformComponentProfile remoteParticipant) {
    System.out.println(
        "----------------------------------\n"
            + "FAILED CONNECTION WITH "
            + remoteParticipant.getAlias()
            + "\n"
            + "--------------------------------------------------------");
    cryptoPaymentRequestExecutorAgent.connectionFailure(remoteParticipant.getIdentityPublicKey());

    // I check my time trying to send the message
    checkFailedDeliveryTime(remoteParticipant.getIdentityPublicKey());
  }
  /** Handles the events CompleteComponentRegistrationNotification */
  public void handleCompleteComponentRegistrationNotificationEvent(
      final PlatformComponentProfile platformComponentProfileRegistered) {

    /*
     * If the component registered have my profile and my identity public key
     */
    if (platformComponentProfileRegistered.getPlatformComponentType()
            == PlatformComponentType.NETWORK_SERVICE
        && platformComponentProfileRegistered.getNetworkServiceType()
            == NetworkServiceType.CRYPTO_PAYMENT_REQUEST
        && platformComponentProfileRegistered
            .getIdentityPublicKey()
            .equals(identity.getPublicKey())) {

      /*
       * Mark as register
       */
      this.register = Boolean.TRUE;

      try {

        cryptoPaymentRequestExecutorAgent =
            new CryptoPaymentRequestExecutorAgent(
                this,
                errorManager,
                eventManager,
                cryptoPaymentRequestNetworkServiceDao,
                wsCommunicationsCloudClientManager,
                getPluginVersionReference());

        cryptoPaymentRequestExecutorAgent.start();

      } catch (CantStartAgentException e) {

        CantStartPluginException pluginStartException =
            new CantStartPluginException(e, "", "Problem initializing crypto payment request dao.");
        errorManager.reportUnexpectedPluginException(
            this.getPluginVersionReference(),
            UnexpectedPluginExceptionSeverity.DISABLES_THIS_PLUGIN,
            pluginStartException);
      }
    }
  }
  @Override
  public void stop() {

    // remove all listeners from the event manager and from the plugin.
    for (FermatEventListener listener : listenersAdded) eventManager.removeListener(listener);

    listenersAdded.clear();

    // close all connections.
    communicationNetworkServiceConnectionManager.closeAllConnection();

    // interrupt the registration agent execution
    communicationRegistrationProcessNetworkServiceAgent.stop();

    // interrupt the executor agent execution
    cryptoPaymentRequestExecutorAgent.stop();

    // set to not registered.
    register = Boolean.FALSE;

    this.serviceStatus = ServiceStatus.STOPPED;
  }