I have some code I need to write a test for that connects to a vendor's SFTP server and puts a file there. Right now the test is connecting to their actual server but I'd rather not do that. Ideally I'd like to use a fake, in memory, sever along the lines of MockFtpServer. The I tried using that one and it gets part of the way there but dies at the point of issuing the actual commands since it doesn't recognize them.
The code in question is a flow setup within Mule ESB.
From Java SFTP server library?: you might be able to use SSHTools (see http://sourceforge.net/projects/sshtools/). They don't provide any good examples but the code base in SVN has some classes that appear to indicate that they support SFTP server commands (see http://sshtools.svn.sourceforge.net/viewvc/sshtools/trunk/j2ssh/src/com/sshtools/daemon/sftp/ and http://sshtools.svn.sourceforge.net/viewvc/sshtools/trunk/j2ssh/src/com/sshtools/j2ssh/sftp/). Some heavy lifting on your part will be necessary.
Let me know if that helps.
You can use org.apache.sshd.server, see https://mina.apache.org/sshd-project/index.html.
It's not trivial to configure, but there is an example: https://github.com/ggrandes/sftpserver
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With