add Frame.MaxLength and implement it for currently needed frames

This commit is contained in:
Lucas Clemente
2016-04-20 15:06:10 +02:00
parent 93cea4f5de
commit 6be70bc29c
7 changed files with 70 additions and 1 deletions

View File

@@ -70,6 +70,16 @@ var _ = Describe("ConnectionCloseFrame", func() {
err := frame.Write(b)
Expect(err).To(HaveOccurred())
})
It("has proper max length", func() {
b := &bytes.Buffer{}
f := &ConnectionCloseFrame{
ErrorCode: 0xDEADBEEF,
ReasonPhrase: "foobar",
}
f.Write(b)
Expect(f.MaxLength()).To(Equal(b.Len()))
})
})
It("is self-consistent", func() {