title: Creating FTP Client Login Issue In java
body: <p>I am using commons.net api in order to create connection to the FTP server. simple code like</p>
  
  <pre><code>String Path = "D:\\FTP";
  File ftpDirectory = new File(Path);
  ftpDirectory.mkdirs();
  
  FtpServerFactory serverFactory = new FtpServerFactory();
  ListenerFactory factory = new ListenerFactory();
  factory.setPort(2221); 
  factory.setServerAddress("192.168.1.110");
  
  serverFactory.addListener("default", factory.createListener());
  PropertiesUserManagerFactory userFactory = new PropertiesUserManagerFactory();
  File userFile = new File("D:\\FTP\\users.properties");
  userFactory.setFile(userFile);
  
  //UserManager um = userFactory.createUserManager();
  UserManager um =new PropertiesUserManager(new ClearTextPasswordEncryptor(),userFile,"admin");
  BaseUser user = new BaseUser();
  user.setName("test");
  user.setPassword("test");
  user.setHomeDirectory(Path);
  um.save(user);
  
  serverFactory.setUserManager(um);
  
  FtpServer ftpServer = serverFactory.createServer();
  ftpServer.start();
  </code></pre>
  
  <p><code>FTPClient</code> Login as shown below</p>
  
  <pre><code>        FTPClient ftp = new FTPClient();
          ftp.connect("192.168.1.110",2221);
          System.out.println("connect done");
          String loging_success = ftp.login("test", "test") == true ? "success" : "failed"; 
          System.out.println("login: "+ loging_success);
  </code></pre>
  
  <p>but i found trouble in order to login to the server.
  i can start server easily but couldn't login to the server..
  my output look like</p>
  
  <blockquote>
    <p>connect done</p>
  </blockquote>
  
  <p>after long time get exception like</p>
  
  <blockquote>
    <p>org.apache.commons.net.ftp.FTPConnectionClosedException: Connection
    closed without indication.    at
    org.apache.commons.net.ftp.FTP.__getReply(FTP.java:313)   at
    org.apache.commons.net.ftp.FTP.__getReply(FTP.java:290)   at
    org.apache.commons.net.ftp.FTP.sendCommand(FTP.java:474)  at
    org.apache.commons.net.ftp.FTP.sendCommand(FTP.java:547)  at
    org.apache.commons.net.ftp.FTP.user(FTP.java:693)     at
    org.apache.commons.net.ftp.FTPClient.login(FTPClient.java:872)    at
    TestFTPServer.connectServer(TestFTPServer.java:213)   at
    TestFTPServer.main(TestFTPServer.java:52)</p>
  </blockquote>
  
  <p>I can't move forward from here...</p>