public void Reconnect (string password, CancellationToken cancellationToken = default (CancellationToken))
{
if (password == null)
throw new ArgumentNullException ("password");
if (identifier == null)
throw new InvalidOperationException ("There is no previous session to restore.");
// Note: the identifier has the following syntax: imap(s)://userName@host:port
int startIndex = identifier.IndexOf (':') + 3;
int endIndex = identifier.IndexOf ('@');
var userName = UnescapeUserName (identifier.Substring (startIndex, endIndex - startIndex));
Connect (engine.Uri, cancellationToken);
Authenticate (userName, password, cancellationToken);
}