@@ -0,0 +1,1780 @@
+package com.firefly.codec.spdy.decode.control;%0A%0Aimport java.nio.ByteBuffer;%0A%0Aimport com.firefly.codec.spdy.decode.AbstractParser;%0Aimport com.firefly.codec.spdy.decode.DecodeStatus;%0Aimport com.firefly.codec.spdy.decode.SpdyDecodingEvent;%0Aimport com.firefly.codec.spdy.decode.SpdySessionAttachment;%0Aimport com.firefly.codec.spdy.decode.utils.NumberProcessUtils;%0Aimport com.firefly.codec.spdy.frames.control.Fields;%0Aimport com.firefly.codec.spdy.frames.control.HeadersFrame;%0Aimport com.firefly.net.Session;%0A%0Apublic class HeadersBodyParser extends AbstractParser %7B%0A%0A%09public HeadersBodyParser(SpdyDecodingEvent spdyDecodingEvent) %7B%0A%09%09super(spdyDecodingEvent);%0A%09%7D%0A%0A%09@Override%0A%09public DecodeStatus parse(ByteBuffer buffer, Session session) %7B%0A%09%09if(isControlFrameUnderflow(buffer, session))%0A%09%09%09return DecodeStatus.BUFFER_UNDERFLOW;%0A%09%09%0A%09%09SpdySessionAttachment attachment = (SpdySessionAttachment)session.getAttachment();%0A%09%09%0A%09%09int streamId = NumberProcessUtils.toUnsigned31bitsInteger(buffer.getInt()); // 4 bytes%0A%09%09// The header block length is the total length - 4 bytes%0A%09%09int headerBlockLength = attachment.controlFrameHeader.getLength() - 4;%0A%09%09HeadersFrame headersFrame = null;%0A%09%09if(headerBlockLength %3E 0) %7B%0A%09%09%09// header block parser%0A%09%09%09Fields fields = attachment.headersBlockParser.parse(streamId, headerBlockLength, buffer, session);%0A%09%09%09headersFrame = new HeadersFrame(attachment.controlFrameHeader.getVersion(),%0A%09%09%09%09%09attachment.controlFrameHeader.getFlags(), %0A%09%09%09%09%09streamId, fields);%0A%09%09%7D else %7B%0A%09%09%09headersFrame = new HeadersFrame(attachment.controlFrameHeader.getVersion(),%0A%09%09%09%09%09attachment.controlFrameHeader.getFlags(), %0A%09%09%09%09%09streamId, null);%0A%09%09%7D%0A%09%09spdyDecodingEvent.onHeaders(headersFrame, session);%0A%09%09return buffer.hasRemaining() ? DecodeStatus.INIT : DecodeStatus.COMPLETE;%0A%09%7D%0A%0A%7D%0A

add headers body parser and test case