DataConnectionFactory connFactory = session.getDataConnection();
if (connFactory instanceof IODataConnectionFactory) {
InetAddress address = ((IODataConnectionFactory) connFactory)
.getInetAddress();
if (address == null) {
session.write(new DefaultFtpReply(
FtpReply.REPLY_503_BAD_SEQUENCE_OF_COMMANDS,
"PORT or PASV must be issued first"));
return;
}
}