Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Any good in memory SFTP servers for Java? [closed]

Tags:

java

sftp

mule

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.

like image 559
Steven Surowiec Avatar asked May 17 '11 21:05

Steven Surowiec


Video Answer


2 Answers

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.

like image 53
Femi Avatar answered Oct 20 '22 19:10

Femi


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

like image 1
Roger Butenuth Avatar answered Oct 20 '22 20:10

Roger Butenuth