Merge pull request #2292 from lucas-clemente/fix-0rtt-drop-test

fix session unit test checking that the client drops 0-RTT packets
This commit is contained in:
Marten Seemann 2020-01-17 16:51:01 +07:00 committed by GitHub
commit 2c67c117f6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -719,18 +719,6 @@ var _ = Describe("Session", func() {
Eventually(done).Should(BeClosed())
})
It("ignores 0-RTT packets", func() {
hdr := &wire.ExtendedHeader{
Header: wire.Header{
IsLongHeader: true,
Type: protocol.PacketType0RTT,
DestConnectionID: srcConnID,
},
PacketNumberLen: protocol.PacketNumberLen2,
}
Expect(sess.handlePacketImpl(getPacket(hdr, nil))).To(BeFalse())
})
It("ignores packets with a different source connection ID", func() {
hdr1 := &wire.ExtendedHeader{
Header: wire.Header{
@ -1944,6 +1932,21 @@ var _ = Describe("Client Session", func() {
Expect(sess.handlePacketImpl(getPacket(hdr2, nil))).To(BeFalse())
})
It("ignores 0-RTT packets", func() {
hdr := &wire.ExtendedHeader{
Header: wire.Header{
IsLongHeader: true,
Type: protocol.PacketType0RTT,
DestConnectionID: srcConnID,
Length: 2 + 6,
Version: sess.version,
},
PacketNumber: 0x42,
PacketNumberLen: protocol.PacketNumberLen2,
}
Expect(sess.handlePacketImpl(getPacket(hdr, []byte("foobar")))).To(BeFalse())
})
// Illustrates that an injected Initial with an ACK frame for an unsent packet causes
// the connection to immediately break down
It("fails on Initial-level ACK for unsent packet", func() {