File theFile = new File("test.txt");
FTPEpr ftpEpr = new FTPEpr("ftp://test:password@foo.bar");
try
{
FtpFileHandler handler = (FtpFileHandler) FileHandlerFactory.getInstance().getFileHandler(ftpEpr);
@SuppressWarnings("unused")
byte[] content = handler.getFileContents(theFile);
}
catch (CourierException ex)
{
// good!!
}
catch (Exception ex)
{
ex.printStackTrace();
Assert.fail();
}
ftpEpr = new FTPEpr("ftp://" + getFtpUser() + "@" + getFtpHostname() + ":9090");
try
{
FtpFileHandler handler = (FtpFileHandler) FileHandlerFactory.getInstance().getFileHandler(ftpEpr);
@SuppressWarnings("unused")
byte[] content = handler.getFileContents(theFile);
}
catch (CourierException ex)
{
// good!!
}
catch (Exception ex)
{
ex.printStackTrace();
Assert.fail();
}
ftpEpr = new FTPEpr("ftp://" + getFtpUser() + "@" + getFtpHostname());
try
{
FtpFileHandler handler = (FtpFileHandler) FileHandlerFactory.getInstance().getFileHandler(ftpEpr);
@SuppressWarnings("unused")
byte[] content = handler.getFileContents(theFile);
}
catch (CourierException ex)
{
// good!!
}