implement the NEW_CONNECTION_ID frame

This commit is contained in:
Marten Seemann 2018-11-13 11:05:33 +07:00
parent b422876a73
commit 2021a21916
5 changed files with 171 additions and 1 deletions

View file

@ -183,6 +183,19 @@ var _ = Describe("Frame parsing", func() {
Expect(frame).To(Equal(f))
})
It("unpacks NEW_CONNECTION_ID frames", func() {
f := &NewConnectionIDFrame{
SequenceNumber: 0x1337,
ConnectionID: protocol.ConnectionID{0xde, 0xad, 0xbe, 0xef},
StatelessResetToken: [16]byte{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15},
}
buf := &bytes.Buffer{}
Expect(f.Write(buf, versionIETFFrames)).To(Succeed())
frame, err := ParseNextFrame(bytes.NewReader(buf.Bytes()), versionIETFFrames)
Expect(err).ToNot(HaveOccurred())
Expect(frame).To(Equal(f))
})
It("unpacks PATH_CHALLENGE frames", func() {
f := &PathChallengeFrame{Data: [8]byte{1, 2, 3, 4, 5, 6, 7, 8}}
err := f.Write(buf, versionIETFFrames)