Any good in memory SFTP servers for Java?

Steven Surowiec picture Steven Surowiec · May 17, 2011 · Viewed 7.3k times · Source

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.

Answer

Femi picture Femi · May 18, 2011

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.