Examples of ListenerFactory


Examples of org.apache.ftpserver.listener.ListenerFactory

    FtpServerFactory serverFactory = new FtpServerFactory();

    serverFactory.setConnectionConfig(new ConnectionConfigFactory()
        .createConnectionConfig());

    ListenerFactory listenerFactory = new ListenerFactory();

    listenerFactory.setPort(PORT);

    listenerFactory
        .setDataConnectionConfiguration(new DataConnectionConfigurationFactory()
            .createDataConnectionConfiguration());

    serverFactory.addListener("default", listenerFactory.createListener());

    PropertiesUserManagerFactory umFactory = new PropertiesUserManagerFactory();
    umFactory.setPasswordEncryptor(new ClearTextPasswordEncryptor());
    umFactory.setFile(USERS_FILE);
View Full Code Here

Examples of org.apache.ftpserver.listener.ListenerFactory

        server.start();
    }

    private void setupListenerFactory(FtpServerFactory serverFactory, int port)
    {
        ListenerFactory listenerFactory = new ListenerFactory();
        // set the port of the listener
        listenerFactory.setPort(port);
        listenerFactory.setIdleTimeout(60000);
        // replace the default listener
        serverFactory.addListener("default", listenerFactory.createListener());
    }
View Full Code Here

Examples of org.apache.ftpserver.listener.ListenerFactory

*/
public class InetAddressBlacklistTest extends ClientTestTemplate {
    protected FtpServerFactory createServer() throws Exception {
        FtpServerFactory server = super.createServer();

        ListenerFactory factory = new ListenerFactory(server.getListener("default"));

        List<InetAddress> blockedAddresses = new ArrayList<InetAddress>();
        blockedAddresses.add(InetAddress.getByName("localhost"));

        factory.setBlockedAddresses(blockedAddresses);

        server.addListener("default", factory.createListener());
       
        return server;
    }
View Full Code Here

Examples of org.apache.ftpserver.listener.ListenerFactory

*/
public class SubnetBlacklistTest extends ClientTestTemplate {
    protected FtpServerFactory createServer() throws Exception {
        FtpServerFactory server = super.createServer();

        ListenerFactory factory = new ListenerFactory(server.getListener("default"));

        List<Subnet> blockedSubnets = new ArrayList<Subnet>();
        blockedSubnets.add(new Subnet(InetAddress.getByName("localhost"), 32));

        factory.setBlockedSubnets(blockedSubnets);

        server.addListener("default", factory.createListener());
       
        return server;
    }
View Full Code Here

Examples of org.apache.ftpserver.listener.ListenerFactory

        FtpServerFactory serverFactory = new FtpServerFactory();

        serverFactory.setConnectionConfig(createConnectionConfigFactory()
                .createConnectionConfig());

        ListenerFactory listenerFactory = new ListenerFactory();

        listenerFactory.setPort(0);

        listenerFactory
                .setDataConnectionConfiguration(createDataConnectionConfigurationFactory()
                        .createDataConnectionConfiguration());

        serverFactory.addListener("default", listenerFactory.createListener());

        PropertiesUserManagerFactory umFactory = new PropertiesUserManagerFactory();
        umFactory.setAdminName("admin");
        umFactory.setPasswordEncryptor(new ClearTextPasswordEncryptor());
        umFactory.setFile(USERS_FILE);
View Full Code Here

Examples of org.apache.ftpserver.listener.ListenerFactory

   
    protected FtpServerFactory createServer() throws Exception {
        assertTrue(FTPSERVER_KEYSTORE.exists());

        FtpServerFactory server = super.createServer();
        ListenerFactory factory = new ListenerFactory(server.getListener("default"));
       
        factory.setImplicitSsl(useImplicit());

        factory.setSslConfiguration(createSslConfiguration().createSslConfiguration());
       
        server.addListener("default", factory.createListener());
       
        return server;
    }
View Full Code Here

Examples of org.apache.ftpserver.listener.ListenerFactory

    @Override
    protected FtpServerFactory createServer() throws Exception {
        FtpServerFactory server = super.createServer();
       
        ListenerFactory listenerFactory = new ListenerFactory(server.getListener("default"));
       
        DataConnectionConfigurationFactory dccFactory = new DataConnectionConfigurationFactory();

        int passivePort = TestUtil.findFreePort(12444);
       
        dccFactory.setPassivePorts(passivePort + "-" + passivePort);
       
        listenerFactory.setDataConnectionConfiguration(dccFactory.createDataConnectionConfiguration());

        server.addListener("default", listenerFactory.createListener());
       
        return server;
    }
View Full Code Here

Examples of org.apache.ftpserver.listener.ListenerFactory

    protected FtpServerFactory doCreateFtpServerFactory() throws Exception {
        assertTrue(FTPSERVER_KEYSTORE.exists());
       
        FtpServerFactory serverFactory = super.createFtpServerFactory();
       
        ListenerFactory listenerFactory = new ListenerFactory(serverFactory.getListener(DEFAULT_LISTENER));
        listenerFactory.setImplicitSsl(useImplicit());
        listenerFactory.setSslConfiguration(createSslConfiguration().createSslConfiguration());
       
        serverFactory.addListener(DEFAULT_LISTENER, listenerFactory.createListener());

        return serverFactory;
    }
View Full Code Here

Examples of org.apache.ftpserver.listener.ListenerFactory

        pumf.setAdminName("admin");
        pumf.setPasswordEncryptor(new ClearTextPasswordEncryptor());
        pumf.setFile(USERS_FILE);
        UserManager userMgr = pumf.createUserManager();
       
        ListenerFactory factory = new ListenerFactory();
        factory.setPort(port);
       
        FtpServerFactory serverFactory = new FtpServerFactory();
        serverFactory.setUserManager(userMgr);
        serverFactory.setFileSystem(fsf);
        serverFactory.setConnectionConfig(new ConnectionConfigFactory().createConnectionConfig());
        serverFactory.addListener(DEFAULT_LISTENER, factory.createListener());

        return serverFactory;
    }
View Full Code Here

Examples of org.apache.ftpserver.listener.ListenerFactory

     */
    public MiltonFtpAdapter( ResourceFactory wrapped, UserManager userManager, FtpActionListener actionListener, int port, boolean autoStart ) throws FtpException {
        log.debug( "creating FTP adapter on port: " + port);
        this.resourceFactory = wrapped;
        FtpServerFactory serverFactory = new FtpServerFactory();
        ListenerFactory factory;
        if( actionListener != null ) {
            log.debug( "using customised milton listener factory" );
            MiltonFtpHandler ftpHandler = new MiltonFtpHandler( new DefaultFtpHandler(), actionListener );
            factory = new MiltonListenerFactory( ftpHandler );
        } else {
            factory = new ListenerFactory();
        }
        factory.setPort( port );
        serverFactory.addListener( "default", factory.createListener() );

        // VERY IMPORTANT
        serverFactory.setFileSystem( this );


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.