public static void main(String arg[]) throws InterruptedException, AppException {
   QuickServer qs =
       new QuickServer(
           new ClientCommandHandler() {
             @Override
             public void handleCommand(ClientHandler handler, String command)
                 throws SocketTimeoutException, IOException {
               System.out.println("command=" + command);
             }
           },
           9999);
   qs.startServer();
 }
Example #2
0
  public void handleInit(QuickServer quickserver) throws Exception {
    Logger logger = null;
    FileHandler xmlLog = null;
    File log = new File("./log/");
    if (!log.canRead()) log.mkdir();
    try {
      logger = Logger.getLogger("");
      logger.setLevel(Level.FINEST);

      logger = Logger.getLogger("org.quickserver.net.qsadmin");
      xmlLog = new FileHandler("log/FtpServer_QSAdmin%u%g.xml", 1024 * 1024, 20, true);
      xmlLog.setLevel(Level.FINEST);
      logger.addHandler(xmlLog);

      logger = Logger.getLogger("org.quickserver");
      xmlLog = new FileHandler("log/FtpServer_QuickServer%u%g.xml", 1024 * 1024, 20, true);
      xmlLog.setLevel(Level.FINEST);
      logger.addHandler(xmlLog);

      logger = Logger.getLogger("ftpserver");
      xmlLog = new FileHandler("log/FtpServer%u%g.xml", 1024 * 1024, 20, true);
      xmlLog.setLevel(Level.FINEST);
      logger.addHandler(xmlLog);

      quickserver.setAppLogger(logger); // img
    } catch (IOException e) {
      System.err.println("Could not create txtLog FileHandler : " + e);
      throw e;
    }
  }
 public void tearDown() {
   try {
     if (server != null) server.stopServer();
   } catch (Exception e) {
     fail("Server could not stop: " + e);
   }
   // server = null;
 }
  public void setUp() {
    server = new QuickServer();
    client = new BlockingClient();
    configServer();

    server.initService(config);

    TestEventHandler.reset();
    TestCommandHandler.reset();

    try {
      server.startServer();
    } catch (Exception e) {
      server = null;
      fail("Server could not start: " + e);
    }
  }