Skip to content

Instantly share code, notes, and snippets.

View breznik's full-sized avatar

Baron breznik

View GitHub Profile
@breznik
breznik / MyServerHandler.java
Created August 12, 2013 22:13
Example code that works when the HttpPostRequestDecoder's setDiscardThreshold(0) method is called, but fails otherwise.
package net.reznik.gist;
import static io.netty.buffer.Unpooled.copiedBuffer;
import static io.netty.handler.codec.http.HttpHeaders.isKeepAlive;
import static io.netty.handler.codec.http.HttpHeaders.Names.CONTENT_TYPE;
import static io.netty.handler.codec.http.HttpResponseStatus.BAD_REQUEST;
import static io.netty.handler.codec.http.HttpResponseStatus.OK;
import static io.netty.handler.codec.http.HttpVersion.HTTP_1_1;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.ByteBufOutputStream;