@Override public void handleUpstream(ChannelHandlerContext ctx, ChannelEvent e) throws Exception { if (e instanceof IdleStateEvent) { channelIdle(ctx, (IdleStateEvent) e); } else { super.handleUpstream(ctx, e); } }
@Override public void handleUpstream(final ChannelHandlerContext ctx, final ChannelEvent e) throws Exception { if (e instanceof ChannelStateEvent) { LOG.info(e.toString()); } super.handleUpstream(ctx, e); }
@Override public void handleUpstream(ChannelHandlerContext ctx, ChannelEvent e) throws Exception { if (e instanceof MessageEvent && ((MessageEvent)e).getMessage() instanceof ChannelBuffer) { ChannelBuffer b = (ChannelBuffer)((MessageEvent)e).getMessage(); bytesReceived.addAndGet(b.readableBytes()); } super.handleUpstream(ctx, e); }
@Override public void handleUpstream(ChannelHandlerContext ctx, ChannelEvent e) throws Exception { if (e instanceof MessageEvent) { final ChannelBuffer message = (ChannelBuffer) ((MessageEvent) e).getMessage(); System.out.println("INCOMING: " + new String(message.array())); } super.handleUpstream(ctx, e); } });
@Override public void handleUpstream(ChannelHandlerContext ctx, ChannelEvent e) throws Exception { if (e instanceof MessageEvent && ((MessageEvent)e).getMessage() instanceof HttpRequest) { HttpRequest request = (HttpRequest)((MessageEvent)e).getMessage(); CacheEntry ce = cache.get(request.getUri()); if (ce != null && ce.getExpires() > System.currentTimeMillis()) { ChannelFuture f = e.getChannel().write(ce.getContent()); f.addListener(ChannelFutureListener.CLOSE); if (!HttpHeaders.isKeepAlive(request)) { f.addListener(ChannelFutureListener.CLOSE); } return; } } super.handleUpstream(ctx, e); }
@Override public void handleUpstream(ChannelHandlerContext ctx, ChannelEvent e) throws Exception { if (e instanceof ShutdownInputEvent) { inputShutdown(ctx, (ShutdownInputEvent) e); } else if (e instanceof ShutdownOutputEvent) { outputShutdown(ctx, (ShutdownOutputEvent) e); } else if (e instanceof FlushEvent) { flushed(ctx, (FlushEvent) e); } else if (e instanceof ReadAbortEvent) { inputAborted(ctx, (ReadAbortEvent) e); } else if (e instanceof WriteAbortEvent) { outputAborted(ctx, (WriteAbortEvent) e); } else { super.handleUpstream(ctx, e); } }