public VaspSessionsManager(
            VaspClient vaspClient,
            IVaspCallbacks vaspCallbacks)
        {
            _vaspClient = vaspClient;

            _originatorVaspCallbacks = new OriginatorVaspCallbacks(
                async(message, originatorSession) =>
            {
                await vaspCallbacks.SessionReplyMessageReceivedAsync(originatorSession.SessionId, message);
            },
                async(message, originatorSession) =>
            {
                await vaspCallbacks.TransferReplyMessageReceivedAsync(originatorSession.SessionId, message);
                if (message.Message.MessageCode == "5")     //todo: handle properly.
                {
                    await originatorSession.TerminateAsync(TerminationMessage.TerminationMessageCode.SessionClosedTransferOccured);
                    originatorSession.Wait();
                }
            },
                async(message, originatorSession) =>
            {
                await vaspCallbacks.TransferConfirmationMessageReceivedAsync(originatorSession.SessionId, message);
                await originatorSession.TerminateAsync(TerminationMessage.TerminationMessageCode.SessionClosedTransferOccured);
                originatorSession.Wait();
            });

            IVaspMessageHandler vaspMessageHandler = new VaspMessageHandlerCallbacks(
                vaspInfo => Task.FromResult(true),
                async(request, currentSession) =>
            {
                _beneficiarySessions[currentSession.SessionId] = currentSession as BeneficiarySession;
                await vaspCallbacks.TransferRequestMessageReceivedAsync(currentSession.SessionId, request);
                return(null);
            },
                async(dispatch, currentSession) =>
            {
                await vaspCallbacks.TransferDispatchMessageReceivedAsync(currentSession.SessionId, dispatch);
                return(null);
            });

            _vaspClient.RunListener(vaspMessageHandler);
        }
        public async Task CreateSessionBetweenVASPs()
        {
            int sessionTerminationCounter = 0;
            SessionTermination sessionTerminationDelegate = @event => { sessionTerminationCounter++; };

            (VaspInformation vaspInfoPerson, VaspContractInfo vaspContractInfoPerson) = await VaspInformationBuilder.CreateForNaturalPersonAsync(
                NodeClient.EthereumRpc,
                Settings.VaspSmartContractAddressPerson,
                Settings.NaturalPersonIds,
                Settings.PlaceOfBirth);

            VaspClient originator = VaspClient.Create(
                vaspInfoPerson,
                vaspContractInfoPerson,
                Settings.PersonHandshakePrivateKeyHex,
                Settings.PersonSignaturePrivateKeyHex,
                NodeClient.EthereumRpc,
                NodeClient.WhisperRpc,
                _fakeEnsProvider,
                _signService,
                NodeClient.TransportClient);

            (VaspInformation vaspInfoJuridical, VaspContractInfo vaspContractInfoJuridical) = await VaspInformationBuilder.CreateForJuridicalPersonAsync(
                NodeClient.EthereumRpc,
                Settings.VaspSmartContractAddressJuridical,
                Settings.JuridicalIds);

            VaspClient beneficiary = VaspClient.Create(
                vaspInfoJuridical,
                vaspContractInfoJuridical,
                Settings.JuridicalHandshakePrivateKeyHex,
                Settings.JuridicalSignaturePrivateKeyHex,
                NodeClient.EthereumRpc,
                NodeClient.WhisperRpc,
                _fakeEnsProvider,
                _signService,
                NodeClient.TransportClient);

            var originatorVaan  = VirtualAssetssAccountNumber.Create(vaspInfoPerson.GetVaspCode(), "524ee3fb082809");
            var beneficiaryVaan = VirtualAssetssAccountNumber.Create(vaspInfoJuridical.GetVaspCode(), "524ee3fb082809");

            IVaspMessageHandler messageHandler = new VaspMessageHandlerCallbacks(
                (vaspInfo) =>
            {
                return(Task.FromResult(true));
            },
                (request, currentSession) =>
            {
                var message = new TransferReplyMessage(currentSession.SessionId, TransferReplyMessage.TransferReplyMessageCode.TransferAccepted,
                                                       request.Originator,
                                                       new Beneficiary("Mr. Test", request.Beneficiary.VAAN),
                                                       new TransferReply(
                                                           request.Transfer.VirtualAssetType,
                                                           request.Transfer.TransferType,
                                                           request.Transfer.Amount,
                                                           "0x0"),
                                                       request.VASP);

                return(Task.FromResult(message));
            },
                (dispatch, currentSession) =>
            {
                var message = new TransferConfirmationMessage(currentSession.SessionId,
                                                              TransferConfirmationMessage.TransferConfirmationMessageCode.TransferConfirmed,
                                                              dispatch.Originator,
                                                              dispatch.Beneficiary,
                                                              dispatch.Transfer,
                                                              dispatch.Transaction,
                                                              dispatch.VASP);

                return(Task.FromResult(message));
            });

            beneficiary.RunListener(messageHandler);

            originator.SessionTerminated  += sessionTerminationDelegate;
            beneficiary.SessionTerminated += sessionTerminationDelegate;

            // change enum to string and add constants
            //beneficiary.TransferRequest += request => new TransferReply(VirtualAssetType.ETH, TransferType.BlockchainTransfer, "10", "1223");
            //beneficiary.TransferDispatch += message => new TransferConfirmationMessage();

            var originatorDoc = Originator.CreateOriginatorForNaturalPerson(
                "Test van der Test",
                originatorVaan,
                new PostalAddress(
                    "StreetX",
                    44,
                    "AddressLineX",
                    "510051",
                    "TownX",
                    Country.List["DE"]),
                new PlaceOfBirth(DateTime.Today.AddYears(-30), "TownX", Country.List["DE"]),
                new NaturalPersonId[]
            {
                new NaturalPersonId("Id", NaturalIdentificationType.NationalIdentityNumber, Country.List["DE"]),
            });
            var session = await originator.CreateSessionAsync(originatorDoc, beneficiaryVaan);

            var transferReply = await session.TransferRequestAsync(new TransferInstruction()
            {
                VirtualAssetTransfer = new VirtualAssetTransfer()
                {
                    TransferType     = TransferType.BlockchainTransfer,
                    VirtualAssetType = VirtualAssetType.ETH,
                    TransferAmount   = "1000000000000000000"
                }
            });

            var transferConformation =
                await session.TransferDispatchAsync(transferReply.Transfer, new Transaction("0xtxhash", DateTime.UtcNow, "0x0...a"));

            Assert.Equal(1, originator.GetActiveSessions().Count);
            Assert.True(originator.GetActiveSessions().First() is OriginatorSession);

            Assert.Equal(1, beneficiary.GetActiveSessions().Count);
            Assert.True(beneficiary.GetActiveSessions().First() is BeneficiarySession);

            await session.TerminateAsync(TerminationMessage.TerminationMessageCode.SessionClosedTransferOccured);

            session.Wait();
            originator.Dispose();
            beneficiary.Dispose();

            Assert.Equal(2, sessionTerminationCounter);


            _testOutputHelper.WriteLine("End of test");
        }