@Override public void handleDownstream(ChannelHandlerContext ctx, ChannelEvent e) throws Exception { if (e instanceof MessageEvent && ((MessageEvent)e).getMessage() instanceof ChannelBuffer) { ChannelBuffer b = (ChannelBuffer)((MessageEvent)e).getMessage(); bytesSent.addAndGet(b.readableBytes()); } super.handleDownstream(ctx, e); }
@Override public void handleDownstream(ChannelHandlerContext ctx, ChannelEvent e) throws Exception { if (e instanceof MessageEvent) { final ChannelBuffer message = (ChannelBuffer) ((MessageEvent) e).getMessage(); System.out.println("OUTGOING: " + new String(message.array())); } super.handleDownstream(ctx, e); }
@Override public void handleDownstream(ChannelHandlerContext ctx, ChannelEvent e) throws Exception { if (e instanceof MessageEvent && ((MessageEvent)e).getMessage() instanceof CachableHttpResponse) { CachableHttpResponse r = (CachableHttpResponse)((MessageEvent)e).getMessage(); if (r.getCacheMaxAge() > 0) { cache.putIfAbsent(r.getRequestUri(), new CacheEntry(r, System.currentTimeMillis() + r.getCacheMaxAge() * 1000)); } } super.handleDownstream(ctx, e); }
@Override public void handleDownstream(ChannelHandlerContext ctx, ChannelEvent e) throws Exception { if (e instanceof ShutdownInputEvent) { shutdownInputRequested(ctx, (ShutdownInputEvent) e); } else if (e instanceof ShutdownOutputEvent) { shutdownOutputRequested(ctx, (ShutdownOutputEvent) e); } else if (e instanceof FlushEvent) { flushRequested(ctx, (FlushEvent) e); } else if (e instanceof ReadAbortEvent) { abortInputRequested(ctx, (ReadAbortEvent) e); } else if (e instanceof WriteAbortEvent) { abortOutputRequested(ctx, (WriteAbortEvent) e); } else { super.handleDownstream(ctx, e); } }