drop support for QUIC 37 and 38

This commit is contained in:
Marten Seemann 2017-11-07 00:19:05 +07:00
parent 2896f582bd
commit 095c29dc2c
20 changed files with 531 additions and 1340 deletions

View file

@ -2,7 +2,7 @@
## v0.6.0 (unreleased)
- Add support for QUIC 38 and 39, drop support for QUIC 35 and 36
- Add support for QUIC 39, drop support for QUIC 35 - 37
- Added `quic.Config` options for maximal flow control windows
- Add a `quic.Config` option for QUIC versions
- Add a `quic.Config` option to request omission of the connection ID from a server

View file

@ -412,7 +412,7 @@ var _ = Describe("Client", func() {
})
It("errors if the version is supported by quic-go, but disabled by the quic.Config", func() {
v := protocol.SupportedVersions[1]
v := protocol.VersionNumber(111)
Expect(v).ToNot(Equal(cl.version))
Expect(config.Versions).ToNot(ContainElement(v))
cl.handlePacket(nil, wire.ComposeGQUICVersionNegotiation(0x1337, []protocol.VersionNumber{v}))

View file

@ -75,7 +75,9 @@ var _ = Describe("Handshake RTT tests", func() {
}
It("fails when there's no matching version, after 1 RTT", func() {
Expect(len(protocol.SupportedVersions)).To(BeNumerically(">", 1))
if len(protocol.SupportedVersions) == 1 {
Skip("Test requires at least 2 supported versions.")
}
serverConfig.Versions = protocol.SupportedVersions[:1]
runServerAndProxy()
clientConfig := &quic.Config{
@ -98,7 +100,9 @@ var _ = Describe("Handshake RTT tests", func() {
})
It("does version negotiation in 1 RTT", func() {
Expect(len(protocol.SupportedVersions)).To(BeNumerically(">", 1))
if len(protocol.SupportedVersions) == 1 {
Skip("Test requires at least 2 supported versions.")
}
// the server doesn't support the highest supported version, which is the first one the client will try
serverConfig.Versions = []protocol.VersionNumber{protocol.SupportedVersions[1]}
runServerAndProxy()

View file

@ -49,7 +49,9 @@ var _ = Describe("Handshake tests", func() {
Context("Version Negotiation", func() {
It("when the server supports more versions than the client", func() {
Expect(len(protocol.SupportedVersions)).To(BeNumerically(">", 1))
if len(protocol.SupportedVersions) == 1 {
Skip("Test requires at least 2 supported versions.")
}
// the server doesn't support the highest supported version, which is the first one the client will try
// but it supports a bunch of versions that the client doesn't speak
serverConfig.Versions = []protocol.VersionNumber{protocol.SupportedVersions[1], 7, 8, 9}
@ -59,7 +61,9 @@ var _ = Describe("Handshake tests", func() {
})
It("when the client supports more versions than the supports", func() {
Expect(len(protocol.SupportedVersions)).To(BeNumerically(">", 1))
if len(protocol.SupportedVersions) == 1 {
Skip("Test requires at least 2 supported versions.")
}
// the server doesn't support the highest supported version, which is the first one the client will try
// but it supports a bunch of versions that the client doesn't speak
runServer()

View file

@ -118,7 +118,7 @@ var _ = Describe("Client Crypto Setup", func() {
&TransportParameters{IdleTimeout: protocol.DefaultIdleTimeout},
paramsChan,
aeadChanged,
protocol.Version37,
protocol.Version39,
nil,
)
Expect(err).ToNot(HaveOccurred())
@ -491,14 +491,14 @@ var _ = Describe("Client Crypto Setup", func() {
})
It("has the right values for an inchoate CHLO", func() {
Expect(cs.version).ToNot(Equal(cs.initialVersion)) // make sure we can test that TagVER actually has the initial version, and not the current version
cs.version = cs.initialVersion - 1
cs.hostname = "sni-hostname"
certManager.commonCertificateHashes = []byte("common certs")
tags, err := cs.getTags()
Expect(err).ToNot(HaveOccurred())
Expect(string(tags[TagSNI])).To(Equal(cs.hostname))
Expect(tags[TagPDMD]).To(Equal([]byte("X509")))
Expect(tags[TagVER]).To(Equal([]byte("Q037")))
Expect(tags[TagVER]).To(Equal([]byte("Q039")))
Expect(tags[TagCCS]).To(Equal(certManager.commonCertificateHashes))
Expect(tags).ToNot(HaveKey(TagTCID))
})

View file

@ -15,9 +15,7 @@ const (
// The version numbers, making grepping easier
const (
Version37 VersionNumber = gquicVersion0 + 3*0x100 + 0x7 + iota
Version38
Version39
Version39 VersionNumber = gquicVersion0 + 3*0x100 + 0x9 + iota
VersionTLS VersionNumber = 101
VersionWhatever VersionNumber = 0 // for when the version doesn't matter
VersionUnknown VersionNumber = -1
@ -27,8 +25,6 @@ const (
// must be in sorted descending order
var SupportedVersions = []VersionNumber{
Version39,
Version38,
Version37,
}
// UsesTLS says if this QUIC version uses TLS 1.3 for the handshake

View file

@ -8,21 +8,15 @@ import (
var _ = Describe("Version", func() {
// version numbers taken from the wiki: https://github.com/quicwg/base-drafts/wiki/QUIC-Versions
It("has the right gQUIC version number", func() {
Expect(Version37).To(BeEquivalentTo(0x51303337))
Expect(Version38).To(BeEquivalentTo(0x51303338))
Expect(Version39).To(BeEquivalentTo(0x51303339))
})
It("says if a version supports TLS", func() {
Expect(Version37.UsesTLS()).To(BeFalse())
Expect(Version38.UsesTLS()).To(BeFalse())
Expect(Version39.UsesTLS()).To(BeFalse())
Expect(VersionTLS.UsesTLS()).To(BeTrue())
})
It("has the right string representation", func() {
Expect(Version37.String()).To(Equal("gQUIC 37"))
Expect(Version38.String()).To(Equal("gQUIC 38"))
Expect(Version39.String()).To(Equal("gQUIC 39"))
Expect(VersionTLS.String()).To(ContainSubstring("TLS"))
Expect(VersionWhatever.String()).To(Equal("whatever"))
@ -35,8 +29,6 @@ var _ = Describe("Version", func() {
})
It("has the right representation for the H2 Alt-Svc tag", func() {
Expect(Version37.ToAltSvc()).To(Equal("37"))
Expect(Version38.ToAltSvc()).To(Equal("38"))
Expect(Version39.ToAltSvc()).To(Equal("39"))
Expect(VersionTLS.ToAltSvc()).To(Equal("101"))
// check with unsupported version numbers from the wiki
@ -46,15 +38,11 @@ var _ = Describe("Version", func() {
})
It("tells the Stream ID of the crypto stream", func() {
Expect(Version37.CryptoStreamID()).To(Equal(StreamID(1)))
Expect(Version38.CryptoStreamID()).To(Equal(StreamID(1)))
Expect(Version39.CryptoStreamID()).To(Equal(StreamID(1)))
Expect(VersionTLS.CryptoStreamID()).To(Equal(StreamID(0)))
})
It("tells if a version uses the MAX_DATA, MAX_STREAM_DATA, BLOCKED and STREAM_BLOCKED frames", func() {
Expect(Version37.UsesMaxDataFrame()).To(BeFalse())
Expect(Version38.UsesMaxDataFrame()).To(BeFalse())
Expect(Version39.UsesMaxDataFrame()).To(BeFalse())
Expect(VersionTLS.UsesMaxDataFrame()).To(BeTrue())
})

View file

@ -26,11 +26,8 @@ type ByteOrder interface {
WriteUfloat16(*bytes.Buffer, uint64)
}
// GetByteOrder gets the ByteOrder (little endian or big endian) used to represent values on the wire
// GetByteOrder gets the ByteOrder to represent values on the wire
// from QUIC 39, values are encoded in big endian, before that in little endian
func GetByteOrder(v protocol.VersionNumber) ByteOrder {
if v == protocol.Version37 || v == protocol.Version38 {
return LittleEndian
}
return BigEndian
}

View file

@ -7,12 +7,8 @@ import (
)
var _ = Describe("Byte Order", func() {
It("says little Little Endian before QUIC 39", func() {
Expect(GetByteOrder(protocol.Version37)).To(Equal(LittleEndian))
Expect(GetByteOrder(protocol.Version38)).To(Equal(LittleEndian))
})
It("says little Little Endian for QUIC 39", func() {
It("says little Little Endian for QUIC 39 and TLS", func() {
Expect(GetByteOrder(protocol.Version39)).To(Equal(BigEndian))
Expect(GetByteOrder(protocol.VersionTLS)).To(Equal(BigEndian))
})
})

File diff suppressed because it is too large Load diff

View file

@ -10,17 +10,6 @@ import (
var _ = Describe("legacy BLOCKED Frame", func() {
Context("when parsing", func() {
Context("in little endian", func() {
It("accepts sample frame", func() {
b := bytes.NewReader([]byte{0x5, 0xef, 0xbe, 0xad, 0xde})
f, err := ParseBlockedFrameLegacy(b, versionLittleEndian)
Expect(err).ToNot(HaveOccurred())
Expect(f).To(BeAssignableToTypeOf(&StreamBlockedFrame{}))
frame := f.(*StreamBlockedFrame)
Expect(frame.StreamID).To(Equal(protocol.StreamID(0xdeadbeef)))
})
})
Context("in big endian", func() {
It("accepts sample frame for a stream", func() {
b := bytes.NewReader([]byte{0x5, 0xde, 0xad, 0xbe, 0xef})
@ -51,15 +40,6 @@ var _ = Describe("legacy BLOCKED Frame", func() {
})
Context("when writing", func() {
Context("in little endian", func() {
It("writes a sample frame", func() {
b := &bytes.Buffer{}
frame := StreamBlockedFrame{StreamID: 0x1337}
frame.Write(b, versionLittleEndian)
Expect(b.Bytes()).To(Equal([]byte{0x5, 0x37, 0x13, 0x0, 0x0}))
})
})
Context("in big endian", func() {
It("writes a BLOCKED frame for a stream", func() {
b := &bytes.Buffer{}

View file

@ -13,44 +13,6 @@ import (
var _ = Describe("ConnectionCloseFrame", func() {
Context("when parsing", func() {
Context("in little endian", func() {
It("accepts sample frame", func() {
b := bytes.NewReader([]byte{0x2,
0x19, 0x0, 0x0, 0x0, // error code
0x1b, 0x0, // reason phrase length
'N', 'o', ' ', 'r', 'e', 'c', 'e', 'n', 't', ' ', 'n', 'e', 't', 'w', 'o', 'r', 'k', ' ', 'a', 'c', 't', 'i', 'v', 'i', 't', 'y', '.',
})
frame, err := ParseConnectionCloseFrame(b, versionLittleEndian)
Expect(err).ToNot(HaveOccurred())
Expect(frame.ErrorCode).To(Equal(qerr.ErrorCode(0x19)))
Expect(frame.ReasonPhrase).To(Equal("No recent network activity."))
Expect(b.Len()).To(BeZero())
})
It("rejects long reason phrases", func() {
b := bytes.NewReader([]byte{0x2,
0xad, 0xfb, 0xca, 0xde, // error code
0x0, 0xff, // reason phrase length
})
_, err := ParseConnectionCloseFrame(b, versionLittleEndian)
Expect(err).To(MatchError(io.EOF))
})
It("errors on EOFs", func() {
data := []byte{0x2,
0x19, 0x0, 0x0, 0x0, // error code
0x1b, 0x0, // reason phrase length
'N', 'o', ' ', 'r', 'e', 'c', 'e', 'n', 't', ' ', 'n', 'e', 't', 'w', 'o', 'r', 'k', ' ', 'a', 'c', 't', 'i', 'v', 'i', 't', 'y', '.',
}
_, err := ParseConnectionCloseFrame(bytes.NewReader(data), versionLittleEndian)
Expect(err).NotTo(HaveOccurred())
for i := range data {
_, err := ParseConnectionCloseFrame(bytes.NewReader(data[0:i]), versionLittleEndian)
Expect(err).To(HaveOccurred())
}
})
})
Context("in big endian", func() {
It("accepts sample frame", func() {
b := bytes.NewReader([]byte{0x2,
@ -102,38 +64,6 @@ var _ = Describe("ConnectionCloseFrame", func() {
})
Context("when writing", func() {
Context("in little endian", func() {
It("writes a frame without a reason phrase", func() {
b := &bytes.Buffer{}
frame := &ConnectionCloseFrame{
ErrorCode: 0xdeadbeef,
}
err := frame.Write(b, versionLittleEndian)
Expect(err).ToNot(HaveOccurred())
Expect(b.Len()).To(Equal(1 + 2 + 4))
Expect(b.Bytes()).To(Equal([]byte{0x2,
0xef, 0xbe, 0xad, 0xde, // error code
0x0, 0x0, // reason phrase length
}))
})
It("writes a frame with a reason phrase", func() {
b := &bytes.Buffer{}
frame := &ConnectionCloseFrame{
ErrorCode: 0xdeadbeef,
ReasonPhrase: "foobar",
}
err := frame.Write(b, versionLittleEndian)
Expect(err).ToNot(HaveOccurred())
Expect(b.Len()).To(Equal(1 + 2 + 4 + len(frame.ReasonPhrase)))
Expect(b.Bytes()).To(Equal([]byte{0x2,
0xef, 0xbe, 0xad, 0xde, // error code
0x6, 0x0, // reason phrase length
'f', 'o', 'o', 'b', 'a', 'r',
}))
})
})
Context("in big endian", func() {
It("writes a frame without a ReasonPhrase", func() {
b := &bytes.Buffer{}

View file

@ -12,40 +12,6 @@ import (
var _ = Describe("GoawayFrame", func() {
Context("when parsing", func() {
Context("in little endian", func() {
It("accepts sample frame", func() {
b := bytes.NewReader([]byte{0x3,
0x37, 0x13, 0x0, 0x0, // error code
0x34, 0x12, 0x0, 0x0, // last good stream id
0x3, 0x0, // reason phrase length
'f', 'o', 'o',
})
frame, err := ParseGoawayFrame(b, versionLittleEndian)
Expect(frame).To(Equal(&GoawayFrame{
ErrorCode: 0x1337,
LastGoodStream: 0x1234,
ReasonPhrase: "foo",
}))
Expect(err).ToNot(HaveOccurred())
Expect(b.Len()).To(BeZero())
})
It("errors on EOFs", func() {
data := []byte{0x3,
0x1, 0x0, 0x0, 0x0, // error code
0x2, 0x0, 0x0, 0x0, // last good stream id
0x3, 0x0, // reason phrase length
'f', 'o', 'o',
}
_, err := ParseGoawayFrame(bytes.NewReader(data), versionLittleEndian)
Expect(err).NotTo(HaveOccurred())
for i := range data {
_, err := ParseGoawayFrame(bytes.NewReader(data[0:i]), versionLittleEndian)
Expect(err).To(HaveOccurred())
}
})
})
Context("in big endian", func() {
It("accepts sample frame", func() {
b := bytes.NewReader([]byte{0x3,
@ -92,25 +58,6 @@ var _ = Describe("GoawayFrame", func() {
})
Context("when writing", func() {
Context("in little endian", func() {
It("writes a sample frame", func() {
b := &bytes.Buffer{}
frame := GoawayFrame{
ErrorCode: 0x1337,
LastGoodStream: 2,
ReasonPhrase: "foo",
}
err := frame.Write(b, versionLittleEndian)
Expect(err).ToNot(HaveOccurred())
Expect(b.Bytes()).To(Equal([]byte{0x3,
0x37, 0x13, 0x0, 0x0, // error code
0x2, 0x0, 0x0, 0x0, // last good stream
0x3, 0x0, // reason phrase length
'f', 'o', 'o',
}))
})
})
Context("in big endian", func() {
It("writes a sample frame", func() {
b := &bytes.Buffer{}

View file

@ -140,50 +140,6 @@ var _ = Describe("Public Header", func() {
})
Context("Packet Number lengths", func() {
Context("in little endian encoding", func() {
version := protocol.Version37
BeforeEach(func() {
Expect(utils.GetByteOrder(version)).To(Equal(utils.LittleEndian))
})
It("accepts 1-byte packet numbers", func() {
b := bytes.NewReader([]byte{0x08, 0x4c, 0xfa, 0x9f, 0x9b, 0x66, 0x86, 0x19, 0xf6, 0xde})
hdr, err := parsePublicHeader(b, protocol.PerspectiveClient, version)
Expect(err).ToNot(HaveOccurred())
Expect(hdr.PacketNumber).To(Equal(protocol.PacketNumber(0xde)))
Expect(hdr.PacketNumberLen).To(Equal(protocol.PacketNumberLen1))
Expect(b.Len()).To(BeZero())
})
It("accepts 2-byte packet numbers", func() {
b := bytes.NewReader([]byte{0x18, 0x4c, 0xfa, 0x9f, 0x9b, 0x66, 0x86, 0x19, 0xf6, 0xde, 0xca})
hdr, err := parsePublicHeader(b, protocol.PerspectiveClient, version)
Expect(err).ToNot(HaveOccurred())
Expect(hdr.PacketNumber).To(Equal(protocol.PacketNumber(0xcade)))
Expect(hdr.PacketNumberLen).To(Equal(protocol.PacketNumberLen2))
Expect(b.Len()).To(BeZero())
})
It("accepts 4-byte packet numbers", func() {
b := bytes.NewReader([]byte{0x28, 0x4c, 0xfa, 0x9f, 0x9b, 0x66, 0x86, 0x19, 0xf6, 0xad, 0xfb, 0xca, 0xde})
hdr, err := parsePublicHeader(b, protocol.PerspectiveClient, version)
Expect(err).ToNot(HaveOccurred())
Expect(hdr.PacketNumber).To(Equal(protocol.PacketNumber(0xdecafbad)))
Expect(hdr.PacketNumberLen).To(Equal(protocol.PacketNumberLen4))
Expect(b.Len()).To(BeZero())
})
It("accepts 6-byte packet numbers", func() {
b := bytes.NewReader([]byte{0x38, 0x4c, 0xfa, 0x9f, 0x9b, 0x66, 0x86, 0x19, 0xf6, 0x23, 0x42, 0xad, 0xfb, 0xca, 0xde})
hdr, err := parsePublicHeader(b, protocol.PerspectiveClient, version)
Expect(err).ToNot(HaveOccurred())
Expect(hdr.PacketNumber).To(Equal(protocol.PacketNumber(0xdecafbad4223)))
Expect(hdr.PacketNumberLen).To(Equal(protocol.PacketNumberLen6))
Expect(b.Len()).To(BeZero())
})
})
Context("in big endian encoding", func() {
version := protocol.Version39
@ -238,9 +194,9 @@ var _ = Describe("Public Header", func() {
PacketNumber: 2,
PacketNumberLen: protocol.PacketNumberLen6,
}
err := hdr.writePublicHeader(b, protocol.PerspectiveServer, versionLittleEndian)
err := hdr.writePublicHeader(b, protocol.PerspectiveServer, versionBigEndian)
Expect(err).ToNot(HaveOccurred())
Expect(b.Bytes()).To(Equal([]byte{0x38, 0x4c, 0xfa, 0x9f, 0x9b, 0x66, 0x86, 0x19, 0xf6, 2, 0, 0, 0, 0, 0}))
Expect(b.Bytes()).To(Equal([]byte{0x38, 0x4c, 0xfa, 0x9f, 0x9b, 0x66, 0x86, 0x19, 0xf6, 0, 0, 0, 0, 0, 2}))
})
It("writes a sample header as a client", func() {
@ -250,9 +206,9 @@ var _ = Describe("Public Header", func() {
PacketNumber: 0x1337,
PacketNumberLen: protocol.PacketNumberLen6,
}
err := hdr.writePublicHeader(b, protocol.PerspectiveClient, versionLittleEndian)
err := hdr.writePublicHeader(b, protocol.PerspectiveClient, versionBigEndian)
Expect(err).ToNot(HaveOccurred())
Expect(b.Bytes()).To(Equal([]byte{0x38, 0x4c, 0xfa, 0x9f, 0x9b, 0x66, 0x86, 0x19, 0xf6, 0x37, 0x13, 0, 0, 0, 0}))
Expect(b.Bytes()).To(Equal([]byte{0x38, 0x4c, 0xfa, 0x9f, 0x9b, 0x66, 0x86, 0x19, 0xf6, 0x0, 0x0, 0x0, 0x0, 0x13, 0x37}))
})
It("refuses to write a Public Header if the PacketNumberLen is not set", func() {
@ -286,7 +242,7 @@ var _ = Describe("Public Header", func() {
PacketNumberLen: protocol.PacketNumberLen1,
DiversificationNonce: bytes.Repeat([]byte{1}, 32),
}
err := hdr.writePublicHeader(b, protocol.PerspectiveServer, versionLittleEndian)
err := hdr.writePublicHeader(b, protocol.PerspectiveServer, versionBigEndian)
Expect(err).ToNot(HaveOccurred())
Expect(b.Bytes()).To(Equal([]byte{
0x0c, 0x4c, 0xfa, 0x9f, 0x9b, 0x66, 0x86, 0x19, 0xf6,
@ -327,7 +283,7 @@ var _ = Describe("Public Header", func() {
b := &bytes.Buffer{}
hdr := Header{
VersionFlag: true,
Version: protocol.Version38,
Version: protocol.Version39,
ConnectionID: 0x4cfa9f9b668619f6,
PacketNumber: 0x42,
PacketNumberLen: protocol.PacketNumberLen1,
@ -339,7 +295,7 @@ var _ = Describe("Public Header", func() {
firstByte, _ := b.ReadByte()
Expect(firstByte & 0x01).To(Equal(uint8(1)))
Expect(firstByte & 0x30).To(Equal(uint8(0x0)))
Expect(string(b.Bytes()[8:12])).To(Equal("Q038"))
Expect(string(b.Bytes()[8:12])).To(Equal("Q039"))
Expect(b.Bytes()[12:13]).To(Equal([]byte{0x42}))
})
})
@ -393,7 +349,7 @@ var _ = Describe("Public Header", func() {
It("errors when PacketNumberLen is not set", func() {
hdr := Header{
ConnectionID: 0x4cfa9f9b668619f6,
PacketNumber: 0xDECAFBAD,
PacketNumber: 0xdecafbad,
}
_, err := hdr.getPublicHeaderLength(protocol.PerspectiveServer)
Expect(err).To(MatchError(errPacketNumberLenNotSet))
@ -402,7 +358,7 @@ var _ = Describe("Public Header", func() {
It("gets the length of a packet with longest packet number length and connectionID", func() {
hdr := Header{
ConnectionID: 0x4cfa9f9b668619f6,
PacketNumber: 0xDECAFBAD,
PacketNumber: 0xdecafbad,
PacketNumberLen: protocol.PacketNumberLen6,
}
length, err := hdr.getPublicHeaderLength(protocol.PerspectiveServer)
@ -414,10 +370,10 @@ var _ = Describe("Public Header", func() {
hdr := Header{
ConnectionID: 0x4cfa9f9b668619f6,
OmitConnectionID: true,
PacketNumber: 0xDECAFBAD,
PacketNumber: 0xdecafbad,
PacketNumberLen: protocol.PacketNumberLen6,
VersionFlag: true,
Version: versionLittleEndian,
Version: versionBigEndian,
}
length, err := hdr.getPublicHeaderLength(protocol.PerspectiveClient)
Expect(err).ToNot(HaveOccurred())
@ -479,62 +435,6 @@ var _ = Describe("Public Header", func() {
Expect(err).To(MatchError("PublicHeader: PacketNumberLen not set"))
})
Context("in little endian", func() {
version := protocol.Version37
BeforeEach(func() {
Expect(utils.GetByteOrder(version)).To(Equal(utils.LittleEndian))
})
It("writes a header with a 1-byte packet number", func() {
b := &bytes.Buffer{}
hdr := Header{
ConnectionID: 0x4cfa9f9b668619f6,
PacketNumber: 0xDECAFBAD,
PacketNumberLen: protocol.PacketNumberLen1,
}
err := hdr.writePublicHeader(b, protocol.PerspectiveServer, version)
Expect(err).ToNot(HaveOccurred())
Expect(b.Bytes()).To(Equal([]byte{0x08, 0x4c, 0xfa, 0x9f, 0x9b, 0x66, 0x86, 0x19, 0xf6, 0xAD}))
})
It("writes a header with a 2-byte packet number", func() {
b := &bytes.Buffer{}
hdr := Header{
ConnectionID: 0x4cfa9f9b668619f6,
PacketNumber: 0xDECAFBAD,
PacketNumberLen: protocol.PacketNumberLen2,
}
err := hdr.writePublicHeader(b, protocol.PerspectiveServer, version)
Expect(err).ToNot(HaveOccurred())
Expect(b.Bytes()).To(Equal([]byte{0x18, 0x4c, 0xfa, 0x9f, 0x9b, 0x66, 0x86, 0x19, 0xf6, 0xad, 0xfb}))
})
It("writes a header with a 4-byte packet number", func() {
b := &bytes.Buffer{}
hdr := Header{
ConnectionID: 0x4cfa9f9b668619f6,
PacketNumber: 0x13DECAFBAD,
PacketNumberLen: protocol.PacketNumberLen4,
}
err := hdr.writePublicHeader(b, protocol.PerspectiveServer, version)
Expect(err).ToNot(HaveOccurred())
Expect(b.Bytes()).To(Equal([]byte{0x28, 0x4c, 0xfa, 0x9f, 0x9b, 0x66, 0x86, 0x19, 0xf6, 0xAD, 0xfb, 0xca, 0xde}))
})
It("writes a header with a 6-byte packet number", func() {
b := &bytes.Buffer{}
hdr := Header{
ConnectionID: 0x4cfa9f9b668619f6,
PacketNumber: 0xBE1337DECAFBAD,
PacketNumberLen: protocol.PacketNumberLen6,
}
err := hdr.writePublicHeader(b, protocol.PerspectiveServer, version)
Expect(err).ToNot(HaveOccurred())
Expect(b.Bytes()).To(Equal([]byte{0x38, 0x4c, 0xfa, 0x9f, 0x9b, 0x66, 0x86, 0x19, 0xf6, 0xad, 0xfb, 0xca, 0xde, 0x37, 0x13}))
})
})
Context("in big endian", func() {
version := protocol.Version39

View file

@ -10,21 +10,6 @@ import (
var _ = Describe("RstStreamFrame", func() {
Context("when parsing", func() {
Context("in little endian", func() {
It("accepts sample frame", func() {
b := bytes.NewReader([]byte{0x1,
0xef, 0xbe, 0xad, 0xde, // stream id
0x88, 0x77, 0x66, 0x55, 0x44, 0x33, 0x22, 0x11, // byte offset
0x34, 0x12, 0x37, 0x13, // error code
})
frame, err := ParseRstStreamFrame(b, versionLittleEndian)
Expect(err).ToNot(HaveOccurred())
Expect(frame.StreamID).To(Equal(protocol.StreamID(0xdeadbeef)))
Expect(frame.ByteOffset).To(Equal(protocol.ByteCount(0x1122334455667788)))
Expect(frame.ErrorCode).To(Equal(uint32(0x13371234)))
})
})
Context("in big endian", func() {
It("accepts sample frame", func() {
b := bytes.NewReader([]byte{0x1,
@ -56,24 +41,6 @@ var _ = Describe("RstStreamFrame", func() {
})
Context("when writing", func() {
Context("in little endian", func() {
It("writes a sample RstStreamFrame", func() {
frame := RstStreamFrame{
StreamID: 0x1337,
ByteOffset: 0x11223344decafbad,
ErrorCode: 0xdeadbeef,
}
b := &bytes.Buffer{}
err := frame.Write(b, versionLittleEndian)
Expect(err).ToNot(HaveOccurred())
Expect(b.Bytes()).To(Equal([]byte{0x01,
0x37, 0x13, 0x0, 0x0, // stream id
0xad, 0xfb, 0xca, 0xde, 0x44, 0x33, 0x22, 0x11, // byte offset
0xef, 0xbe, 0xad, 0xde, // error code
}))
})
})
Context("in big endian", func() {
It("writes a sample RstStreamFrame", func() {
frame := RstStreamFrame{

View file

@ -10,16 +10,6 @@ import (
var _ = Describe("StopWaitingFrame", func() {
Context("when parsing", func() {
Context("in little endian", func() {
It("accepts sample frame", func() {
b := bytes.NewReader([]byte{0x06, 0x34, 0x12})
frame, err := ParseStopWaitingFrame(b, 0x1337, 2, versionLittleEndian)
Expect(err).ToNot(HaveOccurred())
Expect(frame.LeastUnacked).To(Equal(protocol.PacketNumber(0x1337 - 0x1234)))
Expect(b.Len()).To(BeZero())
})
})
Context("in big endian", func() {
It("accepts sample frame", func() {
b := bytes.NewReader([]byte{0x06, 0x12, 0x34})
@ -56,21 +46,6 @@ var _ = Describe("StopWaitingFrame", func() {
})
Context("when writing", func() {
Context("in little endian", func() {
It("writes a sample frame", func() {
b := &bytes.Buffer{}
frame := &StopWaitingFrame{
LeastUnacked: 10,
PacketNumber: 13,
PacketNumberLen: protocol.PacketNumberLen6,
}
err := frame.Write(b, versionLittleEndian)
Expect(err).ToNot(HaveOccurred())
Expect(b.Bytes()[0]).To(Equal(uint8(0x06)))
Expect(b.Bytes()[1:7]).To(Equal([]byte{3, 0, 0, 0, 0, 0}))
})
})
Context("in big endian", func() {
It("writes a sample frame", func() {
b := &bytes.Buffer{}
@ -118,60 +93,6 @@ var _ = Describe("StopWaitingFrame", func() {
})
Context("LeastUnackedDelta length", func() {
Context("in little endian", func() {
It("writes a 1-byte LeastUnackedDelta", func() {
b := &bytes.Buffer{}
frame := &StopWaitingFrame{
LeastUnacked: 10,
PacketNumber: 13,
PacketNumberLen: protocol.PacketNumberLen1,
}
err := frame.Write(b, versionLittleEndian)
Expect(err).ToNot(HaveOccurred())
Expect(b.Len()).To(Equal(2))
Expect(b.Bytes()[1]).To(Equal(uint8(3)))
})
It("writes a 2-byte LeastUnackedDelta", func() {
b := &bytes.Buffer{}
frame := &StopWaitingFrame{
LeastUnacked: 0x10,
PacketNumber: 0x1300,
PacketNumberLen: protocol.PacketNumberLen2,
}
err := frame.Write(b, versionLittleEndian)
Expect(err).ToNot(HaveOccurred())
Expect(b.Len()).To(Equal(3))
Expect(b.Bytes()[1:3]).To(Equal([]byte{0xf0, 0x12}))
})
It("writes a 4-byte LeastUnackedDelta", func() {
b := &bytes.Buffer{}
frame := &StopWaitingFrame{
LeastUnacked: 0x1000,
PacketNumber: 0x12345678,
PacketNumberLen: protocol.PacketNumberLen4,
}
err := frame.Write(b, versionLittleEndian)
Expect(err).ToNot(HaveOccurred())
Expect(b.Len()).To(Equal(5))
Expect(b.Bytes()[1:5]).To(Equal([]byte{0x78, 0x46, 0x34, 0x12}))
})
It("writes a 6-byte LeastUnackedDelta, for a delta that fits into 6 bytes", func() {
b := &bytes.Buffer{}
frame := &StopWaitingFrame{
LeastUnacked: 0x10,
PacketNumber: 0x123456789abc,
PacketNumberLen: protocol.PacketNumberLen6,
}
err := frame.Write(b, versionLittleEndian)
Expect(err).ToNot(HaveOccurred())
Expect(b.Len()).To(Equal(7))
Expect(b.Bytes()[1:7]).To(Equal([]byte{0xbc - 0x10, 0x9a, 0x78, 0x56, 0x34, 0x12}))
})
})
Context("in big endian", func() {
It("writes a 1-byte LeastUnackedDelta", func() {
b := &bytes.Buffer{}

View file

@ -12,58 +12,6 @@ import (
var _ = Describe("StreamFrame", func() {
Context("when parsing", func() {
Context("in little endian", func() {
It("accepts a sample frame", func() {
// a STREAM frame, plus 3 additional bytes, not belonging to this frame
b := bytes.NewReader([]byte{0x80 ^ 0x20,
0x1, // stream id
0x6, 0x0, // data length
'f', 'o', 'o', 'b', 'a', 'r',
'f', 'o', 'o', // additional bytes
})
frame, err := ParseStreamFrame(b, versionLittleEndian)
Expect(err).ToNot(HaveOccurred())
Expect(frame.FinBit).To(BeFalse())
Expect(frame.StreamID).To(Equal(protocol.StreamID(1)))
Expect(frame.Offset).To(BeZero())
Expect(frame.DataLenPresent).To(BeTrue())
Expect(frame.Data).To(Equal([]byte("foobar")))
Expect(b.Len()).To(Equal(3))
})
It("accepts frames with offsets", func() {
b := bytes.NewReader([]byte{0x80 ^ 0x20 /* 2 byte offset */ ^ 0x4,
0x1, // stream id
0x42, 0x0, // offset
0x6, 0x0, // data length
'f', 'o', 'o', 'b', 'a', 'r',
})
frame, err := ParseStreamFrame(b, versionLittleEndian)
Expect(err).ToNot(HaveOccurred())
Expect(frame.FinBit).To(BeFalse())
Expect(frame.StreamID).To(Equal(protocol.StreamID(1)))
Expect(frame.Offset).To(Equal(protocol.ByteCount(0x42)))
Expect(frame.DataLenPresent).To(BeTrue())
Expect(frame.Data).To(Equal([]byte("foobar")))
Expect(b.Len()).To(BeZero())
})
It("errors on EOFs", func() {
data := []byte{0x80 ^ 0x20 ^ 0x4,
0x1, // stream id
0x2a, 0x0, // offset
0x6, 0x0, // data length,
'f', 'o', 'o', 'b', 'a', 'r',
}
_, err := ParseStreamFrame(bytes.NewReader(data), versionLittleEndian)
Expect(err).NotTo(HaveOccurred())
for i := range data {
_, err := ParseStreamFrame(bytes.NewReader(data[0:i]), versionLittleEndian)
Expect(err).To(HaveOccurred())
}
})
})
Context("in big endian", func() {
It("accepts a sample frame", func() {
// a STREAM frame, plus 3 additional bytes, not belonging to this frame
@ -190,23 +138,6 @@ var _ = Describe("StreamFrame", func() {
})
Context("when writing", func() {
Context("in little endian", func() {
It("writes sample frame", func() {
b := &bytes.Buffer{}
err := (&StreamFrame{
StreamID: 1,
Data: []byte("foobar"),
DataLenPresent: true,
}).Write(b, versionLittleEndian)
Expect(err).ToNot(HaveOccurred())
Expect(b.Bytes()).To(Equal([]byte{0x80 ^ 0x20,
0x1, // stream id
0x6, 0x0, // data length
'f', 'o', 'o', 'b', 'a', 'r',
}))
})
})
Context("in big endian", func() {
It("writes sample frame", func() {
b := &bytes.Buffer{}
@ -214,11 +145,11 @@ var _ = Describe("StreamFrame", func() {
StreamID: 1,
Data: []byte("foobar"),
DataLenPresent: true,
}).Write(b, versionLittleEndian)
}).Write(b, versionBigEndian)
Expect(err).ToNot(HaveOccurred())
Expect(b.Bytes()).To(Equal([]byte{0x80 ^ 0x20,
0x1, // stream id
0x6, 0x0, // data length
0x0, 0x6, // data length
'f', 'o', 'o', 'b', 'a', 'r',
}))
})
@ -270,24 +201,6 @@ var _ = Describe("StreamFrame", func() {
})
Context("data length field", func() {
Context("in little endian", func() {
It("writes the data length", func() {
dataLen := 0x1337
b := &bytes.Buffer{}
f := &StreamFrame{
StreamID: 1,
Data: bytes.Repeat([]byte{'f'}, dataLen),
DataLenPresent: true,
Offset: 0,
}
err := f.Write(b, versionLittleEndian)
Expect(err).ToNot(HaveOccurred())
minLength, _ := f.MinLength(0)
Expect(b.Bytes()[0] & 0x20).To(Equal(uint8(0x20)))
Expect(b.Bytes()[minLength-2 : minLength]).To(Equal([]byte{0x37, 0x13}))
})
})
Context("in big endian", func() {
It("writes the data length", func() {
dataLen := 0x1337
@ -339,102 +252,6 @@ var _ = Describe("StreamFrame", func() {
})
Context("offset lengths", func() {
Context("in little endian", func() {
It("does not write an offset if the offset is 0", func() {
b := &bytes.Buffer{}
err := (&StreamFrame{
StreamID: 1,
Data: []byte("foobar"),
Offset: 0,
}).Write(b, versionLittleEndian)
Expect(err).ToNot(HaveOccurred())
Expect(b.Bytes()[0] & 0x1c).To(Equal(uint8(0x0)))
})
It("writes a 2-byte offset if the offset is larger than 0", func() {
b := &bytes.Buffer{}
err := (&StreamFrame{
StreamID: 1,
Data: []byte("foobar"),
Offset: 0x1337,
}).Write(b, versionLittleEndian)
Expect(err).ToNot(HaveOccurred())
Expect(b.Bytes()[0] & 0x1c).To(Equal(uint8(0x1 << 2)))
Expect(b.Bytes()[2:4]).To(Equal([]byte{0x37, 0x13}))
})
It("writes a 3-byte offset if the offset", func() {
b := &bytes.Buffer{}
(&StreamFrame{
StreamID: 1,
Data: []byte("foobar"),
Offset: 0x13cafe,
}).Write(b, versionLittleEndian)
Expect(b.Bytes()[0] & 0x1c).To(Equal(uint8(0x2 << 2)))
Expect(b.Bytes()[2:5]).To(Equal([]byte{0xfe, 0xca, 0x13}))
})
It("writes a 4-byte offset if the offset", func() {
b := &bytes.Buffer{}
err := (&StreamFrame{
StreamID: 1,
Data: []byte("foobar"),
Offset: 0xdeadbeef,
}).Write(b, versionLittleEndian)
Expect(err).ToNot(HaveOccurred())
Expect(b.Bytes()[0] & 0x1c).To(Equal(uint8(0x3 << 2)))
Expect(b.Bytes()[2:6]).To(Equal([]byte{0xef, 0xbe, 0xad, 0xde}))
})
It("writes a 5-byte offset if the offset", func() {
b := &bytes.Buffer{}
err := (&StreamFrame{
StreamID: 1,
Data: []byte("foobar"),
Offset: 0x13deadbeef,
}).Write(b, versionLittleEndian)
Expect(err).ToNot(HaveOccurred())
Expect(b.Bytes()[0] & 0x1c).To(Equal(uint8(0x4 << 2)))
Expect(b.Bytes()[2:7]).To(Equal([]byte{0xef, 0xbe, 0xad, 0xde, 0x13}))
})
It("writes a 6-byte offset if the offset", func() {
b := &bytes.Buffer{}
err := (&StreamFrame{
StreamID: 1,
Data: []byte("foobar"),
Offset: 0xdeadbeefcafe,
}).Write(b, versionLittleEndian)
Expect(err).ToNot(HaveOccurred())
Expect(b.Bytes()[0] & 0x1c).To(Equal(uint8(0x5 << 2)))
Expect(b.Bytes()[2:8]).To(Equal([]byte{0xfe, 0xca, 0xef, 0xbe, 0xad, 0xde}))
})
It("writes a 7-byte offset if the offset", func() {
b := &bytes.Buffer{}
err := (&StreamFrame{
StreamID: 1,
Data: []byte("foobar"),
Offset: 0x13deadbeefcafe,
}).Write(b, versionLittleEndian)
Expect(err).ToNot(HaveOccurred())
Expect(b.Bytes()[0] & 0x1c).To(Equal(uint8(0x6 << 2)))
Expect(b.Bytes()[2:9]).To(Equal([]byte{0xfe, 0xca, 0xef, 0xbe, 0xad, 0xde, 0x13}))
})
It("writes a 8-byte offset if the offset", func() {
b := &bytes.Buffer{}
err := (&StreamFrame{
StreamID: 1,
Data: []byte("foobar"),
Offset: 0x1337deadbeefcafe,
}).Write(b, versionLittleEndian)
Expect(err).ToNot(HaveOccurred())
Expect(b.Bytes()[0] & 0x1c).To(Equal(uint8(0x7 << 2)))
Expect(b.Bytes()[2:10]).To(Equal([]byte{0xfe, 0xca, 0xef, 0xbe, 0xad, 0xde, 0x37, 0x13}))
})
})
Context("in big endian", func() {
It("does not write an offset if the offset is 0", func() {
b := &bytes.Buffer{}
@ -533,65 +350,6 @@ var _ = Describe("StreamFrame", func() {
})
Context("lengths of StreamIDs", func() {
Context("in little endian", func() {
It("writes a 1 byte StreamID", func() {
b := &bytes.Buffer{}
err := (&StreamFrame{
StreamID: 13,
Data: []byte("foobar"),
}).Write(b, versionLittleEndian)
Expect(err).ToNot(HaveOccurred())
Expect(b.Bytes()[0] & 0x3).To(Equal(uint8(0x0)))
Expect(b.Bytes()[1]).To(Equal(uint8(13)))
})
It("writes a 2 byte StreamID", func() {
b := &bytes.Buffer{}
err := (&StreamFrame{
StreamID: 0xcafe,
Data: []byte("foobar"),
}).Write(b, versionLittleEndian)
Expect(err).ToNot(HaveOccurred())
Expect(b.Bytes()[0] & 0x3).To(Equal(uint8(0x1)))
Expect(b.Bytes()[1:3]).To(Equal([]byte{0xfe, 0xca}))
})
It("writes a 3 byte StreamID", func() {
b := &bytes.Buffer{}
err := (&StreamFrame{
StreamID: 0x13beef,
Data: []byte("foobar"),
}).Write(b, versionLittleEndian)
Expect(err).ToNot(HaveOccurred())
Expect(b.Bytes()[0] & 0x3).To(Equal(uint8(0x2)))
Expect(b.Bytes()[1:4]).To(Equal([]byte{0xef, 0xbe, 0x13}))
})
It("writes a 4 byte StreamID", func() {
b := &bytes.Buffer{}
err := (&StreamFrame{
StreamID: 0xdecafbad,
Data: []byte("foobar"),
}).Write(b, versionLittleEndian)
Expect(err).ToNot(HaveOccurred())
Expect(b.Bytes()[0] & 0x3).To(Equal(uint8(0x3)))
Expect(b.Bytes()[1:5]).To(Equal([]byte{0xad, 0xfb, 0xca, 0xde}))
})
It("writes a multiple byte StreamID, after the Stream length was already determined by MinLenght()", func() {
b := &bytes.Buffer{}
frame := &StreamFrame{
StreamID: 0xdecafbad,
Data: []byte("foobar"),
}
frame.MinLength(0)
err := frame.Write(b, versionLittleEndian)
Expect(err).ToNot(HaveOccurred())
Expect(b.Bytes()[0] & 0x3).To(Equal(uint8(0x3)))
Expect(b.Bytes()[1:5]).To(Equal([]byte{0xad, 0xfb, 0xca, 0xde}))
})
})
Context("in big endian", func() {
It("writes a 1 byte StreamID", func() {
b := &bytes.Buffer{}

View file

@ -10,22 +10,6 @@ import (
var _ = Describe("WINDOW_UPDATE frame", func() {
Context("parsing", func() {
Context("in little endian", func() {
It("accepts sample frame", func() {
b := bytes.NewReader([]byte{0x4,
0xef, 0xbe, 0xad, 0xde, // stream id
0x44, 0x33, 0x22, 0x11, 0xad, 0xfb, 0xca, 0xde, // byte offset
})
f, err := ParseWindowUpdateFrame(b, versionLittleEndian)
Expect(err).ToNot(HaveOccurred())
Expect(f).To(BeAssignableToTypeOf(&MaxStreamDataFrame{}))
frame := f.(*MaxStreamDataFrame)
Expect(frame.StreamID).To(Equal(protocol.StreamID(0xdeadbeef)))
Expect(frame.ByteOffset).To(Equal(protocol.ByteCount(0xdecafbad11223344)))
Expect(b.Len()).To(BeZero())
})
})
Context("in big endian", func() {
It("parses a stream-level WINDOW_UPDATE", func() {
b := bytes.NewReader([]byte{0x4,
@ -82,22 +66,6 @@ var _ = Describe("WINDOW_UPDATE frame", func() {
Expect(f.MinLength(versionBigEndian)).To(Equal(protocol.ByteCount(1 + 4 + 8)))
})
Context("in little endian", func() {
It("writes a sample frame", func() {
b := &bytes.Buffer{}
f := &windowUpdateFrame{
StreamID: 0xdecafbad,
ByteOffset: 0xdeadbeefcafe1337,
}
err := f.Write(b, versionLittleEndian)
Expect(err).ToNot(HaveOccurred())
Expect(b.Bytes()).To(Equal([]byte{0x4,
0xad, 0xfb, 0xca, 0xde, // stream id
0x37, 0x13, 0xfe, 0xca, 0xef, 0xbe, 0xad, 0xde, // byte offset
}))
})
})
Context("in big endian", func() {
It("writes a stream-level WINDOW_UPDATE frame", func() {
b := &bytes.Buffer{}

View file

@ -15,8 +15,6 @@ func TestCrypto(t *testing.T) {
}
const (
// a QUIC version that uses little endian encoding
versionLittleEndian = protocol.Version37
// a QUIC version that uses big endian encoding
versionBigEndian = protocol.Version39
// a QUIC version that uses the MAX_DATA / MAX_STREAM_DATA and BLOCKED / STREAM_BLOCKED frames
@ -24,10 +22,8 @@ const (
)
var _ = BeforeSuite(func() {
Expect(utils.GetByteOrder(versionLittleEndian)).To(Equal(utils.LittleEndian))
Expect(utils.GetByteOrder(versionBigEndian)).To(Equal(utils.BigEndian))
Expect(utils.GetByteOrder(versionMaxDataFrame)).To(Equal(utils.BigEndian))
Expect(versionLittleEndian.UsesMaxDataFrame()).To(BeFalse())
Expect(versionBigEndian.UsesMaxDataFrame()).To(BeFalse())
Expect(versionMaxDataFrame.UsesMaxDataFrame()).To(BeTrue())
})

View file

@ -181,7 +181,7 @@ var _ = Describe("Session", func() {
var pSess Session
pSess, handshakeChan, err = newSession(
mconn,
protocol.Version37,
protocol.Version39,
0,
scfg,
nil,
@ -230,7 +230,7 @@ var _ = Describe("Session", func() {
}
pSess, _, err := newSession(
mconn,
protocol.Version37,
protocol.Version39,
0,
scfg,
nil,
@ -621,7 +621,10 @@ var _ = Describe("Session", func() {
sess.Close(nil)
Eventually(areSessionsRunning).Should(BeFalse())
Expect(mconn.written).To(HaveLen(1))
Expect(mconn.written).To(Receive(ContainSubstring(string([]byte{0x02, byte(qerr.PeerGoingAway), 0, 0, 0, 0, 0}))))
buf := &bytes.Buffer{}
err := (&wire.ConnectionCloseFrame{ErrorCode: qerr.PeerGoingAway}).Write(buf, sess.version)
Expect(err).ToNot(HaveOccurred())
Expect(mconn.written).To(Receive(ContainSubstring(string(buf.Bytes()))))
Expect(sess.Context().Done()).To(BeClosed())
})
@ -782,23 +785,23 @@ var _ = Describe("Session", func() {
Context("sending packets", func() {
It("sends ACK frames", func() {
packetNumber := protocol.PacketNumber(0x035E)
packetNumber := protocol.PacketNumber(0x035e)
sess.receivedPacketHandler.ReceivedPacket(packetNumber, true)
err := sess.sendPacket()
Expect(err).NotTo(HaveOccurred())
Expect(mconn.written).To(HaveLen(1))
Expect(mconn.written).To(Receive(ContainSubstring(string([]byte{0x5E, 0x03}))))
Expect(mconn.written).To(Receive(ContainSubstring(string([]byte{0x03, 0x5e}))))
})
It("sends ACK frames when congestion limited", func() {
sess.sentPacketHandler = &mockSentPacketHandler{congestionLimited: true}
sess.packer.packetNumberGenerator.next = 0x1338
packetNumber := protocol.PacketNumber(0x035E)
packetNumber := protocol.PacketNumber(0x035e)
sess.receivedPacketHandler.ReceivedPacket(packetNumber, true)
err := sess.sendPacket()
Expect(err).NotTo(HaveOccurred())
Expect(mconn.written).To(HaveLen(1))
Expect(mconn.written).To(Receive(ContainSubstring(string([]byte{0x5E, 0x03}))))
Expect(mconn.written).To(Receive(ContainSubstring(string([]byte{0x03, 0x5e}))))
})
It("sends a retransmittable packet when required by the SentPacketHandler", func() {
@ -1046,7 +1049,7 @@ var _ = Describe("Session", func() {
defer sess.Close(nil)
time.Sleep(10 * time.Millisecond)
Eventually(func() int { return len(mconn.written) }).ShouldNot(BeZero())
Expect(mconn.written).To(Receive(ContainSubstring(string([]byte{0x37, 0x13}))))
Expect(mconn.written).To(Receive(ContainSubstring(string([]byte{0x13, 0x37}))))
})
Context("bundling of small packets", func() {
@ -1114,8 +1117,8 @@ var _ = Describe("Session", func() {
Expect(err).NotTo(HaveOccurred())
Eventually(mconn.written).Should(HaveLen(2))
Expect(mconn.written).To(Receive(ContainSubstring(string([]byte{0x37, 0x13}))))
Expect(mconn.written).ToNot(Receive(ContainSubstring(string([]byte{0x37, 0x13}))))
Expect(mconn.written).To(Receive(ContainSubstring(string([]byte{0x13, 0x37}))))
Expect(mconn.written).ToNot(Receive(ContainSubstring(string([]byte{0x13, 0x37}))))
})
})
})
@ -1529,7 +1532,7 @@ var _ = Describe("Client Session", func() {
sessP, _, err := newClientSession(
mconn,
"hostname",
protocol.Version37,
protocol.Version39,
0,
nil,
populateClientConfig(&Config{}),