A few notes/questions from a first review: 1) Your tipical onCommand implementation is:
public void onCommand(SMTPSession session) { //deviation from the Main code //Instead of throwing exception just end the session try{ doAUTH(session, session.getCommandArgument()); } catch (Exception ex) { session.getLogger().error("Exception occured:" + ex.getMessage()); session.endSession(); } } You catch "Exception" and return a generic error closing the session. I'm not sure but IIRC the original code didn't catch the exception in every command but has specific catch outside. It could be probably better to add the possible exception to the CommandHandler / ConnectHandler interfaces and add the "throws" in the onCommand/onConnect so you don't have to catch the generic exception while handling the command. The main thing I don't like is the "catch(Exception ex)" that will catch EVERY problem and hide the whole stacktrace/cause. 2) Why do we need a "private final static String COMMAND_NAME" inside every command handler? "Is it"/"Will it be" used? The mapping between command name and command handler is done at configuration level so I don't understand the meaning of that private string. 3) Why did you choose to create a private inner class SMTPSessionImpl implementing the SMTPSession instead of make the SMTPHandler to implement the interface itself? 4) Why did you choose to create the following states?: private final static byte COMMAND_MODE = 1; private final static byte RESPONSE_MODE = 2; private final static byte MESSAGE_RECEIVED_MODE = 3; private final static byte MESSAGE_ABORT_MODE = 4; Can you explain the meaning of the states and their usage? In particular I'm interested to know why do you need to add the RESPONSE_MODE ? 5) I've not tested it but I'm not sure you handle the RSET correctly. I don't see anywhere the assignment of mode = COMMAND_MODE when you reset the session (after an RSET). Stefano PS: I didn't run the code, only merged it with my code and read it. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]