title: JSch "pipe closed" when using SFTP download InputStream after disconnect
body: <p>I am using JSch to open a SFTP channel to a remote server. I use the below code to open the connection and download the file:</p>
  <pre><code>public org.springframework.core.io.Resource download(){
      JSch jsch = new Jsch();
      Session session = jsch.get(&quot;root&quot;, &quot;192.168.1.10&quot;, 22);
      session.setPassword(&quot;root&quot;);
      session.setConfig(&quot;StrictHostKeyChecking&quot;,&quot;no&quot;);
      session.connect();
      ChannelSftp channelSftp = (ChannelSftp) session.openChannel(&quot;sftp&quot;);
      channelSftp.connect();
      InputStream is = channelSftp.get(&quot;/root/example.mp4&quot;);
      channelSftp.exit();
      session.disconnect();
      return new org.springframework.core.io.InputStreamResource(is);    
  }
  </code></pre>
  <p>The problem is:</p>
  <ol>
  <li>If I use <code>exit()</code> and/or <code>disconnect()</code> method, there will be <code>Pipe closed</code> exception thrown</li>
  <li>If I don't, my method return a <code>Resource</code> successfully but the channel/session is still in  <code>connected</code> state.</li>
  </ol>
  <p>So I have a question for this implementation whether there is something wrong ? If there isn't, will the number of sessions increase till the SFTP server denies or they will be closed at a time in future, how can I handle this ?</p>
  <p>Thank you in advanced</p>