codec-http2: Stop leaking in header downgrader test

Motivation:

We're leaking requests in our Http2ServerDowngrader tests when we
allocate a buffer using the local allocator.

Modification:

Release the request later when the request is constructed with the local
allocator.

Result:

Less leaky tests.
This commit is contained in:
Moses Nakamura 2016-05-09 18:14:33 -07:00 committed by Norman Maurer
parent 24784bfcd1
commit 4d2e91a10d

View File

@ -34,6 +34,7 @@ import io.netty.handler.codec.http.HttpResponseStatus;
import io.netty.handler.codec.http.HttpVersion;
import io.netty.handler.codec.http.LastHttpContent;
import io.netty.util.CharsetUtil;
import io.netty.util.ReferenceCountUtil;
import org.junit.Test;
@ -246,6 +247,7 @@ public class Http2ServerDowngraderTest {
assertTrue(ch.writeInbound(new DefaultHttp2HeadersFrame(headers, true)));
FullHttpRequest request = ch.readInbound();
ReferenceCountUtil.releaseLater(request);
assertThat(request.uri(), is("/"));
assertThat(request.method(), is(HttpMethod.GET));
assertThat(request.protocolVersion(), is(HttpVersion.HTTP_1_1));