/**
   * This method process the message received and save on the data base in the table <code>
   * incoming_messages</code> and notify all observers to the new messages received
   */
  private void processMessageReceived() {

    try {

      // System.out.println("CommunicationNetworkServiceRemoteAgent -
      // communicationsVPNConnection.isActive() = "+communicationsVPNConnection.isActive());

      /** Verified the status of the connection */
      if (communicationsVPNConnection.isActive()) {

        // System.out.println("CommunicationNetworkServiceRemoteAgent -
        // communicationsVPNConnection.getUnreadMessagesCount() =
        // "+communicationsVPNConnection.getUnreadMessagesCount());

        /** process all pending messages */
        for (int i = 0; i < communicationsVPNConnection.getUnreadMessagesCount(); i++) {

          /*
           * Read the next message in the queue
           */
          FermatMessage message = communicationsVPNConnection.readNextMessage();

          /*
           * Validate the message signature
           */
          AsymmetricCryptography.verifyMessageSignature(
              message.getSignature(),
              message.getContent(),
              communicationsVPNConnection
                  .getRemoteParticipantNetworkService()
                  .getIdentityPublicKey());

          /*
           * Decrypt the message content
           */
          ((FermatMessageCommunication) message)
              .setContent(
                  AsymmetricCryptography.decryptMessagePrivateKey(
                      message.getContent(), eccKeyPair.getPrivateKey()));

          /*
           * Change to the new status
           */
          ((FermatMessageCommunication) message)
              .setFermatMessagesStatus(FermatMessagesStatus.NEW_RECEIVED);

          /*
           * Save to the data base table
           */
          incomingMessageDao.create(message);

          /*
           * Remove the message from the queue
           */
          communicationsVPNConnection.removeMessageRead(message);

          /*
           * Notify all observer of this agent that Received a new message
           */
          setChanged();
          notifyObservers(message);
        }
      }

      // Sleep for a time
      toReceive.sleep(CommunicationNetworkServiceRemoteAgent.SLEEP_TIME);

    } catch (InterruptedException e) {
      errorManager.reportUnexpectedPluginException(
          Plugins.BITDUBAI_DAP_ASSET_ISSUER_ACTOR_NETWORK_SERVICE,
          UnexpectedPluginExceptionSeverity.DISABLES_SOME_FUNCTIONALITY_WITHIN_THIS_PLUGIN,
          new Exception("Can not sleep"));
    } catch (CantInsertRecordDataBaseException e) {
      errorManager.reportUnexpectedPluginException(
          Plugins.BITDUBAI_DAP_ASSET_ISSUER_ACTOR_NETWORK_SERVICE,
          UnexpectedPluginExceptionSeverity.DISABLES_SOME_FUNCTIONALITY_WITHIN_THIS_PLUGIN,
          new Exception("Can not process message received. Error reason: " + e.getMessage()));
    }
  }