// Add the text line decoder which limit the max line length,
// don't strip the delimiter and use CRLF as delimiter
// Use a SwitchableDelimiterBasedFrameDecoder, see JAMES-1436
pipeline.addLast(FRAMER, new SwitchableDelimiterBasedFrameDecoder(maxLineLength, false, Delimiters.lineDelimiter()));
Encryption secure = getEncryption();
if (secure != null && !secure.isStartTLS()) {
// We need to set clientMode to false.
// See https://issues.apache.org/jira/browse/JAMES-1025
SSLEngine engine = secure.getContext().createSSLEngine();
engine.setUseClientMode(false);
pipeline.addFirst(SSL_HANDLER, new SslHandler(engine));
}
pipeline.addLast(CONNECTION_COUNT_HANDLER, getConnectionCountHandler());