Make sure we not leak messages in the SPDY example

This commit is contained in:
Norman Maurer 2014-01-21 07:34:30 +01:00
parent 36166a4faa
commit 2b63d2d0cd

View File

@ -20,8 +20,8 @@ import java.util.Date;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import io.netty.channel.ChannelFutureListener;
import io.netty.channel.ChannelHandlerAdapter;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;
import io.netty.handler.codec.http.DefaultFullHttpResponse;
import io.netty.handler.codec.http.FullHttpResponse;
import io.netty.handler.codec.http.HttpRequest;
@ -35,14 +35,14 @@ import static io.netty.handler.codec.http.HttpVersion.*;
/**
* HTTP handler that responds with a "Hello World"
*/
public class SpdyServerHandler extends ChannelHandlerAdapter {
public class SpdyServerHandler extends SimpleChannelInboundHandler<Object> {
@Override
public void channelReadComplete(ChannelHandlerContext ctx) {
ctx.flush();
}
@Override
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
public void messageReceived(ChannelHandlerContext ctx, Object msg) throws Exception {
if (msg instanceof HttpRequest) {
HttpRequest req = (HttpRequest) msg;