When using the default classes in an embedded environment, the following situation arises:
-Configure FtpServerFactory with addListener("default", someListener)
-Create server via FtpServerFactory.createServer()
-Start / stop the created FTPServer instance
-Create a new server instance with FtpServerFactory.createServer()
-new server does not have a listener. in fact, the FtpServerFactory listener map gets cleared the moment the first FtpServer.stop() is called.
In my opinion, this problem occurs because the FtpServerFactory is assigned to the same DefaultFtpServerContext as the server instances, which clear the listener maps on FtpServer.stop(). This should not happen, since the FtpServerFactory and its Context must be out-of-scope for the FtpServer instances.