diff --git a/spring-integration-sftp/src/main/java/org/springframework/integration/sftp/session/SftpSession.java b/spring-integration-sftp/src/main/java/org/springframework/integration/sftp/session/SftpSession.java index 55cdbc560c..15def88edc 100644 --- a/spring-integration-sftp/src/main/java/org/springframework/integration/sftp/session/SftpSession.java +++ b/spring-integration-sftp/src/main/java/org/springframework/integration/sftp/session/SftpSession.java @@ -118,6 +118,9 @@ public class SftpSession implements Session { this.jschSession.connect(); this.channel = (ChannelSftp) this.jschSession.openChannel("sftp"); } + if (this.channel != null && !this.channel.isConnected()) { + this.channel.connect(); + } } catch (JSchException e) { throw new IllegalStateException("failed to connect", e);