'SFTP retry using Spring Integration

I am using spring integration to connect the server using SFTP. Is there anyway I can setup retry in case of connection failure ?

My code:

public SessionFactory<Channel.LsEntry> sftpSessionFactory(){
DefaultSftpSessionFactory factory = new DafaultSessionFactory(true);
factory.setHost(host);
factory.setPort(port);
factory.setUser(user);
factory.setPassword(password);
return new CachingSesaionFactory<>(factory);
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source