public String readLine() throws Exception { if (!isReadLast) { handler.handleRequest(in, out, session); isReadLast = true; } final String result = out.nextLine(); return result; }
@Override protected void processStreamIo(final ChannelHandlerContext ctx, final InputStream in, final OutputStream out) { final ImapSessionImpl imapSession = (ImapSessionImpl) getAttachment(ctx).get(IMAP_SESSION); Channel channel = ctx.getChannel(); // Store the stream as attachment OutputStream bufferedOut = new StartTLSOutputStream(out); getAttachment(ctx).put(BUFFERED_OUT, bufferedOut); // handle requests in a loop while (channel.isConnected() && handler.handleRequest(in, bufferedOut, imapSession)); if (imapSession != null) imapSession.logout(); logger.debug("Thread execution complete for session " + channel.getId()); channel.close(); }