public void IncorrectPortFailure() { Reset(); Random rand = new Random(DateTime.Now.Millisecond); int random = rand.Next() % 1000; Uri uri; Uri.TryCreate(Host + random, UriKind.Absolute, out uri); _session = new SMSession(uri, false, _options); AttachSessionEvents(_session); SMProtocol smProtocol = _session.Protocol; smProtocol.OnError += (s, e) => { _isError = true; _eventRaisedStream.Set(); }; _session.Open(); _eventRaisedSession.WaitOne(); Assert.IsTrue(_isError); }
/// <summary> /// Create new session. /// </summary> /// <param name="uri">Uri.</param> /// <returns>New session.</returns> private static SMSession CreateSession(Uri uri, SMProtocolOptions options) { _session = new SMSession(uri, false, options); _session.Open(); return(_session); }