public void testConsume_EncryptedPassword() throws Exception {
    if (areTestsEnabled()) {
      MockMessageListener listener = new MockMessageListener();
      RelaxedFtpConsumer ftpConsumer = new RelaxedFtpConsumer();
      ConfiguredConsumeDestination ccd = new ConfiguredConsumeDestination(getDestinationString());
      ccd.setConfiguredThreadName("testBasicConsumeWithEncryptedPassword");
      ftpConsumer.setDestination(ccd);
      ftpConsumer.setOlderThan(DEFAULT_QUIET_PERIOD);
      ftpConsumer.registerAdaptrisMessageListener(listener);
      ftpConsumer.setPoller(new QuartzCronPoller("*/1 * * * * ?"));
      StandaloneConsumer sc = new StandaloneConsumer(createConnection(), ftpConsumer);
      start(sc);
      int count = 1;
      try {
        FileTransferConnectionUsingPassword conn = createConnection();
        String pw = conn.getDefaultPassword();
        String decodedPw = Password.decode(pw);
        if (pw.equals(decodedPw)) {
          // The password was never encrypted!
          conn.setDefaultPassword(
              Password.encode(conn.getDefaultPassword(), Password.PORTABLE_PASSWORD));
        }
        produce(new StandaloneProducer(conn, createFtpProducer()), count);
        waitForMessages(listener, count);

        assertMessages(listener.getMessages(), count);
      } finally {
        stop(sc);
      }
    }
  }
 public void testConnect_EncodedPassword() throws Exception {
   if (areTestsEnabled()) {
     FileTransferConnectionUsingPassword connection =
         (FileTransferConnectionUsingPassword) createConnection();
     String ensureEncodedPassword =
         Password.encode(
             Password.decode(connection.getDefaultPassword()), Password.PORTABLE_PASSWORD);
     connection.setDefaultPassword(ensureEncodedPassword);
     try {
       start(connection);
       FileTransferClient client = connection.connect(getDestinationString());
     } finally {
       stop(connection);
     }
   }
 }