/// <summary>
        /// Sets the given uri's and establish the connection according RFC.
        ///
        /// Throws IOException if there was a connection problem.
        /// </summary>
        /// <param name="uris">the to-path to use.</param>
        public void SetToPath(List <Uri> uris)
        {
            if (ToPath != null && ToPath.Count > 0)
            {
                throw new IllegalUseException("SetToPath can only be called once!");
            }

            foreach (Uri uri in uris)
            {
                if (RegexMSRP.IsMsrpUri(uri))
                {
                    ToPath.Add(uri);
                }
                else
                {
                    throw new IllegalUseException(string.Format("Invalid To-URI: {0}", uri));
                }
            }
            Connection.AddEndPoint(GetNextURI(), LocalAddress);

            TransactionManager = Connection.TransactionManager;
            TransactionManager.AddSession(this);
            TransactionManager.Initialize(this);

            _stack.AddActiveSession(this);

            _logger.Debug(string.Format("Added {0} toPaths with URI[0]={1}", _toPath.Count.ToString(), uris[0].ToString()));
        }
Exemple #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="session"></param>
        public void IdentifiedSession(Session session)
        {
            _urisSessionsToIdentify.Remove(session.Uri.ToString());
            _existingURISessions.Add(session.Uri);

            session.Connection = _stack.GetConnectionByLocalURI(session.GetNextURI().GetCompleteAuthority());

            _stack.AddActiveSession(session);
        }