Examples of FtpServer


Examples of org.apache.ftpserver.FtpServer

            ftpServer.stop();
        }
    }

    protected void initFtpServer() throws Exception {
        ftpServer = new FtpServer();

        // setup user management to read our users.properties and use clear text passwords
        PropertiesUserManager uman = new PropertiesUserManager();
        uman.setFile(new File("./src/test/resources/users.properties").getAbsoluteFile());
        uman.setPasswordEncryptor(new ClearTextPasswordEncryptor());
View Full Code Here

Examples of org.apache.ftpserver.FtpServer

  {
    try
    {
      Configuration configuration = new PropertiesConfiguration( ftpProperties );
      FtpServerContext context = new ConfigurableFtpServerContext( configuration );
      server = new FtpServer( context );
      server.start();
    }
    catch (IOException e)
    {
      log.error( e );
View Full Code Here

Examples of org.apache.ftpserver.FtpServer

      log.info("prop-file path: " + path + "res/user.gen");
      config.setProperty("config.user-manager.encrypt-passwords", config.getString("config.user-manager.encrypt-passwords", "true"));
      config.setProperty("config.user-manager.base-path", path);

      FtpServerContext ftpConfig = new ConfigurableFtpServerContext(config);
      server = new FtpServer(ftpConfig);
      server.start();
      super.startService();
   }
View Full Code Here

Examples of org.apache.ftpserver.FtpServer

       
       
        serverFactory.addListener("default", defaultListener);
        serverFactory.addListener("second", secondListener);
       
        FtpServer server = serverFactory.createServer();
       
        try {
            server.start();
           
            // Windows seems to allow for both listeners to bind on the same port...
            //fail("Must throw FtpServerConfigurationException");
        } catch(FtpServerConfigurationException e) {
            if(e.getCause() instanceof BindException) {
                // OK!
               
                // we failed to start, make sure things are shut down correctly
                assertTrue(defaultListener.isStopped());
                assertTrue(secondListener.isStopped());
                assertTrue(server.isStopped());
            } else {
                throw e;
            }
        }
    }
View Full Code Here

Examples of org.apache.ftpserver.FtpServer

        // create service context
        FtpServerContext ftpConfig = new ConfigurableFtpServerContext(config);

        // create the server object and start it
        return new FtpServer(ftpConfig);
    }
View Full Code Here

Examples of org.apache.ftpserver.FtpServer

    private static final String UNKNOWN_PASSWORD = "bar";

   
   
    protected FtpServer createServer() throws Exception {
      FtpServer server = super.createServer();
       
      DefaultFtpServerContext context = (DefaultFtpServerContext) server.getServerContext();
     
      DefaultConnectionConfig cc = (DefaultConnectionConfig) context.getConnectionConfig();
      cc.setMaxLoginFailures(0);
        return server;
    }
View Full Code Here

Examples of org.apache.ftpserver.FtpServer

import org.apache.ftpserver.FtpServer;
import org.apache.ftpserver.listener.nio.NioListener;

public class InetAddressBlacklistTest extends ClientTestTemplate {
    protected FtpServer createServer() throws Exception {
        FtpServer server = super.createServer();
       
        NioListener listener = (NioListener) server.getServerContext().getListener("default");
       
        List<InetAddress> blockedAddresses = new ArrayList<InetAddress>();
        blockedAddresses.add(InetAddress.getByName("localhost"));
       
        listener.setBlockedAddresses(blockedAddresses);
View Full Code Here

Examples of org.apache.ftpserver.FtpServer

   
    public static void main(String[] args) throws Exception {
        try{
            if(server == null) {
                // get configuration
                FtpServer server = getConfiguration(args);
                if(server == null) {
                    LOG.error("No configuration provided");
                    throw new FtpException("No configuration provided");
                }
            }
           
            String command = "start";
           
            if(args != null && args.length > 0) {
                command = args[0];
            }
           
            if(command.equals("start")) {
                LOG.info("Starting FTP server daemon");
                server.start();
               
                synchronized (lock) {
                    lock.wait();
                }
            } else if(command.equals("stop")) {
                synchronized (lock) {
                    lock.notify();
                }
                LOG.info("Stopping FTP server daemon");
                server.stop();
            }
        } catch(Throwable t) {
            LOG.error("Daemon error", t);
        }
    }
View Full Code Here

Examples of org.apache.ftpserver.FtpServer

    /**
     * Get the configuration object.
     */
    private static FtpServer getConfiguration(String[] args) throws Exception {
   
        FtpServer server = null;
        if(args == null || args.length < 2) {
            LOG.info("Using default configuration....");
            server = new FtpServer();
        } else if( (args.length == 2) && args[1].equals("-default") ) {
            // supported for backwards compatibility, but not documented
            System.out.println("The -default switch is deprecated, please use --default instead");
            LOG.info("Using default configuration....");
            server = new FtpServer();
        } else if( (args.length == 2) && args[1].equals("--default") ) {
            LOG.info("Using default configuration....");
            server = new FtpServer();
        }
        else if( args.length == 2 ) {
            LOG.info("Using xml configuration file " + args[1] + "...");
            XmlBeanFactory bf = new XmlBeanFactory(new FileSystemResource(args[1]));
            if(bf.containsBean("server")) {
View Full Code Here

Examples of org.apache.ftpserver.FtpServer

import org.apache.ftpserver.listener.nio.NioListener;
import org.apache.mina.filter.firewall.Subnet;

public class SubnetBlacklistTest extends ClientTestTemplate {
    protected FtpServer createServer() throws Exception {
        FtpServer server = super.createServer();
       
        NioListener listener = (NioListener) server.getServerContext().getListener("default");
       
        List<Subnet> blockedSubnets = new ArrayList<Subnet>();
        blockedSubnets.add(new Subnet(InetAddress.getByName("localhost"), 32));
       
        listener.setBlockedSubnets(blockedSubnets);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.