當前位置: 首頁>>代碼示例>>Java>>正文


Java ListenerFactory.createListener方法代碼示例

本文整理匯總了Java中org.apache.ftpserver.listener.ListenerFactory.createListener方法的典型用法代碼示例。如果您正苦於以下問題:Java ListenerFactory.createListener方法的具體用法?Java ListenerFactory.createListener怎麽用?Java ListenerFactory.createListener使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.ftpserver.listener.ListenerFactory的用法示例。


在下文中一共展示了ListenerFactory.createListener方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: startFtpServer

import org.apache.ftpserver.listener.ListenerFactory; //導入方法依賴的package包/類
@BeforeClass
public static void startFtpServer() throws FtpException {
    FtpServerFactory serverFactory = new FtpServerFactory();
    BaseUser user = new BaseUser();
    user.setName("ftp");
    user.setPassword("secret");
    serverFactory.getUserManager().save(user);
    ListenerFactory factory = new ListenerFactory();
    factory.setPort(0);
    Listener listener = factory.createListener();
    serverFactory.addListener("default", listener);
    ftpServer = serverFactory.createServer();
    ftpServer.start();
    ftpPort = listener.getPort();
}
 
開發者ID:Alexey1Gavrilov,項目名稱:ExpectIt,代碼行數:16,代碼來源:AntHarnessTest.java

示例2: testFailStartingSecondListener

import org.apache.ftpserver.listener.ListenerFactory; //導入方法依賴的package包/類
public void testFailStartingSecondListener() throws Exception {
    // FTPSERVER-197
    
    FtpServerFactory serverFactory = new FtpServerFactory();
    
    ListenerFactory listenerFactory = new ListenerFactory();
    listenerFactory.setPort(0);
    
    // let's create two listeners on the same port, second should not start
 
    Listener defaultListener = listenerFactory.createListener();
    Listener secondListener = listenerFactory.createListener();
    
    
    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;
        }
    }
}
 
開發者ID:saaconsltd,項目名稱:mina-ftpserver,代碼行數:38,代碼來源:DefaultFtpServerTest.java

示例3: nioListener

import org.apache.ftpserver.listener.ListenerFactory; //導入方法依賴的package包/類
@Bean
Listener nioListener(@Value("${ftp.port}") int port) throws Exception {
    ListenerFactory listenerFactory = new ListenerFactory();
    listenerFactory.setPort(port);
    return listenerFactory.createListener();
}
 
開發者ID:joshlong,項目名稱:cloudfoundry-ftp-service-broker,代碼行數:7,代碼來源:FtpServerConfiguration.java


注:本文中的org.apache.ftpserver.listener.ListenerFactory.createListener方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。