public void mmCoreMainTest()
        {
            Console.WriteLine("Starting test 01 (Create, Send, Receive)");
            //Set up connector settings. Host = localhost (where the mproxy/mmcore is installed) port =8088
            setUpConnector();
            //Content to be sent
            content = System.Text.ASCIIEncoding.ASCII.GetBytes(contentStr);

            initializeSenderPersonalData();
            initializeReceiverPersonalData();
            MMCoreConnector.WRAccount.person remoteSender   = verifyServerAccountExist(sender);
            MMCoreConnector.WRAccount.person remoteReceiver = verifyServerAccountExist(receiver);
            if (remoteSender == null)
            {
                remoteSender = createServerAccount(sender);
            }

            if (remoteReceiver == null)
            {
                remoteReceiver = createServerAccount(receiver);
            }
            updateLocalPassword(remoteReceiver, receiver.password);
            updateLocalPassword(remoteSender, sender.password);
            receiver = remoteReceiver;
            sender   = remoteSender;

            if (!verifyLocalAccountExist(sender))
            {
                createLocalAccount(sender);
                certify(sender);
            }
            if (!verifyLocalAccountExist(receiver))
            {
                createLocalAccount(receiver);
                certify(receiver);
            }

            MMCoreConnector.WRQueueManagement.mproxyIntegrationMessage mim = createTestIntMessage();

            string msgId = sendIntMessage(mim, MMCoreConnector.WRQueueManagement.mailBoxAccountType.MAILBOX_MEDIBRIDGE_MMCORE);

            Console.WriteLine("SENT MSG ID: " + msgId);
            verifyNoError(sender.login, msgId);
            System.Threading.Thread.Sleep(10000);
            HashSet <string> msgIds = receiveMessageIds(receiver.login);

            if (msgIds.Contains(msgId))
            {
                Console.WriteLine("The MESSAGE:" + msgId + " is received");
            }
            else
            {
                throw new Exception("The MESSAGE:" + msgId + " is NOT received!");
            }
            fetchMessage(receiver.login, msgId);
            deleteMessage(receiver.login, msgId);
        }
        private static void certify(MMCoreConnector.WRAccount.person person)
        {
            Console.WriteLine("CERTIFYING : " + person.login);

            string keyLabel = person.login;


            MMCoreConnector.WRCertification.mproxyOperationStatus ops;
            MMCoreConnector.WRAdapters.mproxyOperationStatus      mosA;
            ops = services.MMCoreServiceCertification.deleteKeyStore(keyLabel);
            ops = services.MMCoreServiceCertification.createEmptyKeyStore(keyLabel, PINCODE);

            Console.WriteLine("RESULT: " + ops.operationResult + " INFO: " + ops.detailedInfo + " OUT: " + ops.operationOutputValue);
            Console.WriteLine("Last status:" + services.MMCoreServiceCertification.getLastSuccessfullOperation(keyLabel, PINCODE).operationOutputValue);

            ops = services.MMCoreServiceCertification.generateAuthenticationKeys(keyLabel, PINCODE, false);
            Console.WriteLine("RESULT: " + ops.operationResult + " INFO: " + ops.detailedInfo + " OUT: " + ops.operationOutputValue);
            Console.WriteLine("Last status:" + services.MMCoreServiceCertification.getLastSuccessfullOperation(keyLabel, PINCODE).operationOutputValue);

            ops = services.MMCoreServiceCertification.prepareAuthenticationCertificateRequest(keyLabel, PINCODE, "", false);
            Console.WriteLine("RESULT: " + ops.operationResult + " INFO: " + ops.detailedInfo + " OUT: " + ops.operationOutputValue);
            Console.WriteLine("Last status:" + services.MMCoreServiceCertification.getLastSuccessfullOperation(keyLabel, PINCODE).operationOutputValue);

            mosA = services.MMCoreServiceAdapters.processAuthenticationCertificateRequest(keyLabel, PINCODE, ops.operationOutputValue);
            Console.WriteLine("RESULT: " + mosA.operationResult + " INFO: " + mosA.detailedInfo + " OUT: " + mosA.operationOutputValue);
            Console.WriteLine("Last status:" + services.MMCoreServiceCertification.getLastSuccessfullOperation(keyLabel, PINCODE).operationOutputValue);

            ops = services.MMCoreServiceCertification.processAuthenticationCertificateResponse(keyLabel, PINCODE, mosA.operationOutputValue, services.MMCoreServiceAdapters.retrieveCaAuthCertChain());
            Console.WriteLine("RESULT: " + ops.operationResult + " INFO: " + ops.detailedInfo + " OUT: " + ops.operationOutputValue);
            Console.WriteLine("Last status:" + services.MMCoreServiceCertification.getLastSuccessfullOperation(keyLabel, PINCODE).operationOutputValue);

            string certAuthS = ops.operationOutputValue;

            ops = services.MMCoreServiceCertification.generateEncryptionKeys(keyLabel, PINCODE);
            Console.WriteLine("RESULT: " + ops.operationResult + " INFO: " + ops.detailedInfo + " OUT: " + ops.operationOutputValue);
            Console.WriteLine("Last status:" + services.MMCoreServiceCertification.getLastSuccessfullOperation(keyLabel, PINCODE).operationOutputValue);

            ops = services.MMCoreServiceCertification.prepareEtkRequest(keyLabel, PINCODE);
            Console.WriteLine("RESULT: " + ops.operationResult + " INFO: " + ops.detailedInfo + " OUT: " + ops.operationOutputValue);
            Console.WriteLine("Last status:" + services.MMCoreServiceCertification.getLastSuccessfullOperation(keyLabel, PINCODE).operationOutputValue);

            string certEncS = ops.operationOutputValue;

            mosA = services.MMCoreServiceAdapters.processEtkRequest(keyLabel, certAuthS, certEncS);
            Console.WriteLine("RESULT: " + mosA.operationResult + " INFO: " + mosA.detailedInfo + " OUT: " + mosA.operationOutputValue);
            Console.WriteLine("Last status:" + services.MMCoreServiceCertification.getLastSuccessfullOperation(keyLabel, PINCODE).operationOutputValue);

            ops = services.MMCoreServiceCertification.processEtkResponse(keyLabel, mosA.operationOutputValue);
            Console.WriteLine("RESULT: " + ops.operationResult + " INFO: " + ops.detailedInfo + " OUT: " + ops.operationOutputValue);
            Console.WriteLine("Last status:" + services.MMCoreServiceCertification.getLastSuccessfullOperation(keyLabel, PINCODE).operationOutputValue);

            mosA = services.MMCoreServiceAdapters.retrieveEtk(keyLabel);
            Console.WriteLine("RESULT: " + mosA.operationResult + " INFO: " + mosA.detailedInfo + " OUT: " + mosA.operationOutputValue);
            Console.WriteLine("Etk S: " + mosA.operationOutputValue);
        }
        private static void initializeSenderPersonalData()
        {
            MMCoreConnector.WRAccount.person person = new MMCoreConnector.WRAccount.person();
            person.firstName = SenderFirstName;
            person.lastName  = SenderLastName + Guid.NewGuid();
            person.login     = person.firstName + "." + person.lastName;
            Random randomGenerator = new Random();

            person.version  = "VERSION_MPROXY";
            person.password = person.firstName;
            person.city     = "BRUXELLES";
            long inami = 800000L + randomGenerator.Next(100000);
            long niss  = 700000000L + randomGenerator.Next(100000000);

            person.niss  = (niss.ToString());
            person.inami = (inami.ToString());
            sender       = person;
        }
 private static void createLocalAccount(MMCoreConnector.WRAccount.person person)
 {
     Console.WriteLine("createLocalAccount : " + person.login);
     MMCoreConnector.WRMailBoxAccount.mproxyOperationStatus mosp = services.MMCoreServiceMailBoxAccount.createDefault(person.login, person.mexiAddress);
     Console.WriteLine("createLocalAccount : " + person.login + " RES: " + mosp.operationResult + "   INFO: " + mosp.detailedInfo);
     if (mosp.operationResult.Equals(MMCoreConnector.WRMailBoxAccount.mproxyOperationResult.MPROXY_RESULT_OK))
     {
         if (mosp.detailedInfo.Equals("Successfully created"))
         {
             Console.WriteLine("createLocalAccount : " + person.login + " CREATED");
         }
     }
     else
     {
         Console.WriteLine("createLocalAccount : " + person.login + " NOT CREATED...");
     }
     updateLocalAccountPassword(person);
 }
 private static MMCoreConnector.WRAccount.person verifyServerAccountExist(MMCoreConnector.WRAccount.person person)
 {
     MMCoreConnector.WRAccount.person res = null;
     Console.WriteLine("verifyServerAccountExist : " + person.login);
     MMCoreConnector.WRAccount.mproxyOperationStatusPerson mosp = services.MMCoreServiceAccount.findAccount(person.login);
     Console.WriteLine("verifyServerAccountExist : " + person.login + "  IS: " + mosp.operationResult);
     if (mosp.operationResult.Equals(MMCoreConnector.WRAccount.mproxyOperationResult.MPROXY_RESULT_OK))
     {
         if (mosp.detailedInfo.Equals("Account found"))
         {
             Console.WriteLine("verifyServerAccountExist : " + person.login + " FOUND!");
             res = mosp.value[0];
         }
     }
     else
     {
         Console.WriteLine("verifyServerAccountExist : " + person.login + " NOT FOUND...");
     }
     return(res);
 }
        private static bool verifyLocalAccountExist(MMCoreConnector.WRAccount.person person)
        {
            bool res = false;

            Console.WriteLine("verifyLocalAccountExist : " + person.login);
            MMCoreConnector.WRMailBoxAccount.mproxyOperationStatusAccount mosp = services.MMCoreServiceMailBoxAccount.readById(person.login);
            Console.WriteLine("verifyLocalAccountExist : " + person.login + "  IS: " + mosp.operationResult);
            if (mosp.operationResult.Equals(MMCoreConnector.WRMailBoxAccount.mproxyOperationResult.MPROXY_RESULT_OK))
            {
                if (mosp.detailedInfo.Equals("Successfully read"))
                {
                    Console.WriteLine("verifyLocalAccountExist : " + person.login + " FOUND!");
                    res = true;
                }
            }
            else
            {
                Console.WriteLine("verifyLocalAccountExist : " + person.login + " NOT FOUND...");
            }
            return(res);
        }
        private static void updateLocalAccountPassword(MMCoreConnector.WRAccount.person person)
        {
            MMCoreConnector.WRMailBoxAccount.mailBoxAccount accountLoc = null;

            MMCoreConnector.WRMailBoxAccount.mproxyOperationStatusAccount mosp = services.MMCoreServiceMailBoxAccount.readById(person.login);
            Console.WriteLine("verifyLocalAccountExist : " + person.login + "  IS: " + mosp.operationResult);
            if (mosp.operationResult.Equals(MMCoreConnector.WRMailBoxAccount.mproxyOperationResult.MPROXY_RESULT_OK))
            {
                if (mosp.detailedInfo.Equals("Successfully read"))
                {
                    accountLoc = mosp.value[0];
                    Console.WriteLine("updateLocalAccountPassword : "******" FOUND!");
                }
            }
            else
            {
                Console.WriteLine("updateLocalAccountPassword : "******" NOT FOUND...");
            }
            accountLoc.password = person.password;
            services.MMCoreServiceMailBoxAccount.update(accountLoc);
        }
 private static MMCoreConnector.WRAccount.person createServerAccount(MMCoreConnector.WRAccount.person person)
 {
     MMCoreConnector.WRAccount.person res = null;
     Console.WriteLine("createServerAccount : " + person.login);
     MMCoreConnector.WRAccount.mproxyOperationStatusPerson mosp = services.MMCoreServiceAccount.createAccountWS(person);
     Console.WriteLine("createServerAccount : " + person.login + " RES: " + mosp.operationResult + "   INFO: " + mosp.detailedInfo);
     if (mosp.operationResult.Equals(MMCoreConnector.WRAccount.mproxyOperationResult.MPROXY_RESULT_OK))
     {
         if (mosp.detailedInfo.Equals("Account created"))
         {
             Console.WriteLine("createServerAccount : " + person.login + " CREATED");
             res = mosp.value[0];
         }
     }
     else
     {
         Console.WriteLine("createServerAccount : " + person.login + " NOT CREATED...");
         res = null;
     }
     return(res);
 }
 private void updateLocalPassword(MMCoreConnector.WRAccount.person person, string password)
 {
     person.password = password;
 }