{
HpackEncoder encoder = new HpackEncoder();
HpackDecoder decoder = new HpackDecoder(4096,8192);
ByteBuffer buffer = BufferUtil.allocate(16*1024);
HttpFields fields0 = new HttpFields();
fields0.add(HttpHeader.CONTENT_TYPE,"text/html");
fields0.add(HttpHeader.CONTENT_LENGTH,"1024");
fields0.add(ServerJetty);
fields0.add(XPowerJetty);
fields0.add(Date);
fields0.add(HttpHeader.SET_COOKIE,"abcdefghijklmnopqrstuvwxyz");
fields0.add("custom-key","custom-value");
Response original0 = new MetaData.Response(HttpVersion.HTTP_2,200,fields0);
BufferUtil.clearToFill(buffer);
encoder.encode(buffer,original0);
BufferUtil.flipToFlush(buffer,0);
Response decoded0 = (Response)decoder.decode(buffer);
Assert.assertEquals(original0,decoded0);
// Same again?
BufferUtil.clearToFill(buffer);
encoder.encode(buffer,original0);
BufferUtil.flipToFlush(buffer,0);
Response decoded0b = (Response)decoder.decode(buffer);
Assert.assertEquals(original0,decoded0b);
HttpFields fields1 = new HttpFields();
fields1.add(HttpHeader.CONTENT_TYPE,"text/plain");
fields1.add(HttpHeader.CONTENT_LENGTH,"1234");
fields1.add(ServerJetty);
fields0.add(XPowerJetty);
fields0.add(Date);
fields1.add("Custom-Key","Other-Value");
Response original1 = new MetaData.Response(HttpVersion.HTTP_2,200,fields1);
// Same again?
BufferUtil.clearToFill(buffer);
encoder.encode(buffer,original1);