uquic/crypto_stream_test.go
2016-04-10 16:33:55 +02:00

27 lines
585 B
Go

package quic
import (
"bytes"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("CryptoStream", func() {
Context("when parsing", func() {
It("parses sample CHLO message", func() {
tag, msg, err := ParseCryptoMessage(sampleCHLO)
Expect(err).ToNot(HaveOccurred())
Expect(tag).To(Equal(TagCHLO))
Expect(msg).To(Equal(sampleCHLOMap))
})
})
Context("when writing", func() {
It("writes sample message", func() {
b := &bytes.Buffer{}
WriteCryptoMessage(b, TagCHLO, sampleCHLOMap)
Expect(b.Bytes()).To(Equal(sampleCHLO))
})
})
})