title: Client not connected exception with SSH.Net
body: <p>I'm having a strange issue with Renci SSH.Net:</p>
  
  <pre><code>var sftp = new SftpClient(remoteHost, remotePort, remoteUserName, remotePassword);
  try
  {
      sftp.Connect();
      using (var file = new FileOutputStream(filePath))
      {
          sftp.DownloadFile(remoteFileName, file);
      }
  
      sftp.Disconnect(); // *
  }
  catch (Exception ex)
  {
      // log stuff
      throw;
  }
  finally
  {
      sftp.Dispose();
  }
  </code></pre>
  
  <p>The above code throws at <code>// *</code> with the <code>SshConnectionException</code>: "Client not connected", even though on inspecting <code>sftp.IsConnected</code> just before yields <code>true</code>.</p>
  
  <p>The file downloads as expected.</p>
  
  <p>The stacktrace is as follows:</p>
  
  <pre><code>at Renci.SshNet.Session.SendMessage(Message message)
  at Renci.SshNet.Session.SendDisconnect(DisconnectReason reasonCode, String message)
  at Renci.SshNet.Session.Disconnect()
  at Renci.SshNet.BaseClient.Disconnect()
  at My.Program.MyMethod() in c:\path\to\my\program.cs:line 42
  </code></pre>