fix detection when the QUIC version is negotiated

This commit is contained in:
Marten Seemann 2016-12-14 18:27:05 +07:00
parent 099e01f410
commit 2377b3a111
No known key found for this signature in database
GPG key ID: 3603F40B121FCDEA
2 changed files with 20 additions and 0 deletions

View file

@ -150,6 +150,20 @@ var _ = Describe("Client", func() {
return packet
}
It("recognizes that a packet without VersionFlag means that the server accepted the suggested version", func() {
ph := PublicHeader{
PacketNumber: 1,
PacketNumberLen: protocol.PacketNumberLen2,
ConnectionID: 0x1337,
}
b := &bytes.Buffer{}
err := ph.Write(b, protocol.VersionWhatever, protocol.PerspectiveServer)
Expect(err).ToNot(HaveOccurred())
err = client.handlePacket(b.Bytes())
Expect(err).ToNot(HaveOccurred())
Expect(client.versionNegotiated).To(BeTrue())
})
It("changes the version after receiving a version negotiation packet", func() {
startUDPConn()
newVersion := protocol.Version35