예제 #1
0
 @Override
 public void channelConnected(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception {
   context.getWorkers().put(ctx.getChannel(), new MasterWorkerHolder(ctx.getChannel()));
   Channel channel = ctx.getChannel();
   SocketAddress addr = channel.getRemoteAddress();
   SocketLog.info("worker connected , :" + addr.toString());
   super.channelConnected(ctx, e);
 }
  @Override
  public void channelConnected(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception {
    InetSocketAddress address = (InetSocketAddress) ctx.getChannel().getRemoteAddress();
    getLogger(ctx.getChannel())
        .info("Connection established from " + address.getAddress().getHostAddress());

    ImapResponseComposer response =
        new ImapResponseComposerImpl(new ChannelImapResponseWriter(ctx.getChannel()));
    ctx.setAttachment(response);

    // write hello to client
    response.untagged().message("OK").message(hello).end();
    super.channelConnected(ctx, e);
  }