cp.addBefore(NettyConstants.EXECUTION_HANDLER, NettyConstants.HEARTBEAT_HANDLER, heartbeatHandler);
} else {
cp.addBefore(NettyConstants.CORE_HANDLER, NettyConstants.HEARTBEAT_HANDLER, heartbeatHandler);
}
final ResponseEncoder responseEncoder = new ResponseEncoder(encoder, response, session);
processor.process(message, responseEncoder, session);
if (session.getState() == ImapSessionState.LOGOUT) {
// Make sure we close the channel after all the buffers were flushed out
Channel channel = ctx.getChannel();
if (channel.isConnected()) {
channel.write(ChannelBuffers.EMPTY_BUFFER).addListener(ChannelFutureListener.CLOSE);
}
}
final IOException failure = responseEncoder.getFailure();
if (failure != null) {
final Logger logger = session.getLog();
logger.info(failure.getMessage());
if (logger.isDebugEnabled()) {