...
1
2
3
4
5
6
7 package quic
8
9 import (
10 "crypto/tls"
11 "testing"
12 )
13
14 func TestConnReceiveAckForUnsentPacket(t *testing.T) {
15 tc := newTestConn(t, serverSide, permissiveTransportParameters)
16 tc.handshake()
17 tc.writeFrames(packetType1RTT,
18 debugFrameAck{
19 ackDelay: 0,
20 ranges: []i64range[packetNumber]{{0, 10}},
21 })
22 tc.wantFrame("ACK for unsent packet causes CONNECTION_CLOSE",
23 packetType1RTT, debugFrameConnectionCloseTransport{
24 code: errProtocolViolation,
25 })
26 }
27
28
29
30
31 func TestConnReceiveAckForDroppedSpace(t *testing.T) {
32 tc := newTestConn(t, serverSide, permissiveTransportParameters)
33 tc.ignoreFrame(frameTypeAck)
34 tc.ignoreFrame(frameTypeNewConnectionID)
35
36 tc.writeFrames(packetTypeInitial,
37 debugFrameCrypto{
38 data: tc.cryptoDataIn[tls.QUICEncryptionLevelInitial],
39 })
40 tc.wantFrame("send Initial crypto",
41 packetTypeInitial, debugFrameCrypto{
42 data: tc.cryptoDataOut[tls.QUICEncryptionLevelInitial],
43 })
44 tc.wantFrame("send Handshake crypto",
45 packetTypeHandshake, debugFrameCrypto{
46 data: tc.cryptoDataOut[tls.QUICEncryptionLevelHandshake],
47 })
48
49 tc.writeFrames(packetTypeHandshake,
50 debugFrameCrypto{
51 data: tc.cryptoDataIn[tls.QUICEncryptionLevelHandshake],
52 },
53 debugFrameAck{
54 ackDelay: 0,
55 ranges: []i64range[packetNumber]{{0, tc.lastPacket.num + 1}},
56 })
57 tc.wantFrame("handshake finishes",
58 packetType1RTT, debugFrameHandshakeDone{})
59 tc.wantIdle("connection is idle")
60 }
61
View as plain text