project provides a mock/dummy FTP server implementations that can be very useful for testing of FTP client code.
version 2.0 includes a new "fake" implementation of an FTP server. It provides a high-level abstraction for an FTP Server and is suitable for most testing and simulation scenarios. You define a virtual filesystem (internal, in-memory) containing an arbitrary set of files and directories. These files and directories can (optionally) have associated access permissions. You also configure a set of one or more user accounts that control which users can login to the FTP server, and their home (default) directories. The user account is also used when assigning file and directory ownership for new files.
processes FTP client requests and responds with reply codes and reply messages consistent with its configured file system and user accounts, including file and directory permissions, if they have been configured.
Here is an example showing configuration and starting of an FakeFtpServer
with a single user account and a (simulated) Windows file system, defining a directory containing two files. If you wish, you can define a Unix file system, instead.
// Create the server and add a user account
FakeFtpServer fakeFtpServer = new FakeFtpServer();
fakeFtpServer.addUserAccount(new UserAccount("user", "password", "c:
// Set up the Windows filesystem
FileSystem fileSystem = new WindowsFakeFileSystem();
file1.txt", "abcdef 1234567890"));