MailKit.Net.Imap.ImapClient.ReplayConnect C# (CSharp) Метод

ReplayConnect() приватный Метод

private ReplayConnect ( string host, Stream replayStream, CancellationToken cancellationToken = default(CancellationToken) ) : void
host string
replayStream Stream
cancellationToken System.Threading.CancellationToken
Результат void
		internal void ReplayConnect (string host, Stream replayStream, CancellationToken cancellationToken = default (CancellationToken))
		{
			CheckDisposed ();

			if (host == null)
				throw new ArgumentNullException (nameof (host));

			if (replayStream == null)
				throw new ArgumentNullException (nameof (replayStream));

			engine.Uri = new Uri ("imap://" + host);
			engine.Connect (new ImapStream (replayStream, null, ProtocolLogger), cancellationToken);
			engine.TagPrefix = 'A';
			secure = false;

			if (engine.CapabilitiesVersion == 0)
				engine.QueryCapabilities (cancellationToken);

			engine.Disconnected += OnEngineDisconnected;
			OnConnected ();
		}

Usage Example

Пример #1
0
		public void TestImapClientGreetingCapabilities ()
		{
			var commands = new List<ImapReplayCommand> ();
			commands.Add (new ImapReplayCommand ("", "common.capability-greeting.txt"));

			using (var client = new ImapClient ()) {
				try {
					client.ReplayConnect ("localhost", new ImapReplayStream (commands, false), CancellationToken.None);
				} catch (Exception ex) {
					Assert.Fail ("Did not expect an exception in Connect: {0}", ex);
				}

				Assert.IsTrue (client.IsConnected, "Client failed to connect.");

				Assert.AreEqual (GreetingCapabilities, client.Capabilities);
				Assert.AreEqual (1, client.AuthenticationMechanisms.Count);
				Assert.IsTrue (client.AuthenticationMechanisms.Contains ("PLAIN"), "Expected SASL PLAIN auth mechanism");
			}
		}
All Usage Examples Of MailKit.Net.Imap.ImapClient::ReplayConnect