implement changes to the CONNECTION_CLOSE frame

This commit is contained in:
Marten Seemann 2018-10-31 11:21:51 +07:00
parent f82c583957
commit 73ac6b14bf
4 changed files with 103 additions and 37 deletions

View file

@ -51,7 +51,7 @@ var _ = Describe("Frame parsing", func() {
Expect(frame).To(Equal(f))
})
It("unpacks CONNECTION_CLOSE frames", func() {
It("unpacks CONNECTION_CLOSE frames containing QUIC error codes", func() {
f := &ConnectionCloseFrame{ReasonPhrase: "foo"}
err := f.Write(buf, versionIETFFrames)
Expect(err).ToNot(HaveOccurred())
@ -60,6 +60,18 @@ var _ = Describe("Frame parsing", func() {
Expect(frame).To(Equal(f))
})
It("unpacks CONNECTION_CLOSE frames containing application error codes", func() {
f := &ConnectionCloseFrame{
IsApplicationError: true,
ReasonPhrase: "foo",
}
err := f.Write(buf, versionIETFFrames)
Expect(err).ToNot(HaveOccurred())
frame, err := ParseNextFrame(bytes.NewReader(buf.Bytes()), nil, versionIETFFrames)
Expect(err).ToNot(HaveOccurred())
Expect(frame).To(Equal(f))
})
It("unpacks MAX_DATA frames", func() {
f := &MaxDataFrame{
ByteOffset: 0xcafe,