public override void EndElement(string local)
        {
            if (BODY == local)
            {
                if (IsOk)
                {
                    long accountId;
                    TryGetValue(ACCOUNT_ID, out accountId);

                    string username = GetStringValue(USERNAME);
                    string legalEntity = GetStringValue(REGISTRATION_LEGAL_ENTITY);
                    bool fundingEnabled = false.ToString().Equals(GetStringValue(FUNDING_DISALLOWED), StringComparison.OrdinalIgnoreCase);
                    string currency = GetStringValue(CURRENCY);
                    string displayLocale = GetStringValue(DISPLAY_LOCALE);

                    _accountDetails = new AccountDetails(accountId, username, currency, legalEntity, displayLocale, fundingEnabled);
                }
            }
        }
 // exposed for testing
 public Session(AccountDetails accountDetails, string baseUri, IHttpInvoker httpInvoker, IXmlParser xmlParser,
      EventStreamHandler eventStreamHandler, DefaultHandler eventHandler, string sessionId, bool restartStreamOnFailure)
 {
     _accountDetails = accountDetails;
     _baseUri = baseUri;
     _httpInvoker = httpInvoker;
     _xmlParser = xmlParser;
     _eventHandler = eventHandler;
     _eventStreamHandler = eventStreamHandler;
     _sessionId = sessionId;
     _restartStreamOnFailure = restartStreamOnFailure;
 }
 public Session(AccountDetails accountDetails, string baseUri, IHttpInvoker httpInvoker, IXmlParser xmlParser,
                string sessionId, bool restartStreamOnFailure)
 {
     _accountDetails = accountDetails;
     _baseUri = baseUri;
     _httpInvoker = httpInvoker;
     _xmlParser = xmlParser;
     _eventHandler = new DefaultHandler();
     _eventStreamHandler = new EventStreamHandler(new SaxContentHandler(_eventHandler));
     _sessionId = sessionId;
     _restartStreamOnFailure = restartStreamOnFailure;
     _eventHandler.AddHandler(_orderBookEventHandler);
     _eventHandler.AddHandler(_orderBookStatusEventHandler);
     _eventHandler.AddHandler(_orderStateEventHandler);
     _eventHandler.AddHandler(_instructionRejectedEventHandler);
     _eventHandler.AddHandler(_positionEventHandler);
     _eventHandler.AddHandler(_accountStateEventHandler);
     _eventHandler.AddHandler(_historicMarketDataEventHandler);
     _eventHandler.AddHandler(_heartbeatEventHandler);
 }