implement parsing and writing of the STOP_SENDING frame

This commit is contained in:
Marten Seemann 2017-12-08 09:52:49 +07:00
parent 3679c56f7e
commit a6e44f3bfc
4 changed files with 130 additions and 1 deletions

View file

@ -364,6 +364,17 @@ var _ = Describe("Packet unpacker", func() {
Expect(packet.frames).To(Equal([]wire.Frame{f}))
})
It("unpacks STOP_SENDING frames", func() {
f := &wire.StopSendingFrame{StreamID: 0x42}
buf := &bytes.Buffer{}
err := f.Write(buf, versionIETFFrames)
Expect(err).ToNot(HaveOccurred())
setData(buf.Bytes())
packet, err := unpacker.Unpack(hdrBin, hdr, data)
Expect(err).ToNot(HaveOccurred())
Expect(packet.frames).To(Equal([]wire.Frame{f}))
})
It("unpacks ACK frames", func() {
f := &wire.AckFrame{
LargestAcked: 0x13,
@ -393,8 +404,9 @@ var _ = Describe("Packet unpacker", func() {
0x04: qerr.InvalidWindowUpdateData,
0x05: qerr.InvalidWindowUpdateData,
0x09: qerr.InvalidBlockedData,
0x0c: qerr.InvalidFrameData,
0x0e: qerr.InvalidAckData,
0x10: qerr.InvalidStreamData,
0xe: qerr.InvalidAckData,
} {
setData([]byte{b})
_, err := unpacker.Unpack(hdrBin, hdr, data)