@Override public final Response onLine(SMTPSession session, ByteBuffer line, LineHandler<SMTPSession> next) { if (session.getAttachment(HEADERS_COMPLETE, State.Transaction) == null) { if (line.remaining() == 2) { if (line.get() == '\r' && line.get() == '\n') { line.rewind(); Response response = onSeparatorLine(session, line, next); session.setAttachment(HEADERS_COMPLETE, Boolean.TRUE, State.Transaction); return response; } line.rewind(); } return onHeadersLine(session, line, next); } return onBodyLine(session, line, next); }
@Override protected Response onSeparatorLine(SMTPSession session, ByteBuffer line, LineHandler<SMTPSession> next) { if (getLocation() == Location.Suffix && session.getAttachment(headersSuffixAdded, State.Transaction) == null) { session.setAttachment(headersSuffixAdded, Boolean.TRUE, State.Transaction); return addHeaders(session, line, next); } return super.onSeparatorLine(session, line, next); }