forked from quic-go/quic-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
multiplexer_test.go
30 lines (26 loc) · 1.04 KB
/
multiplexer_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package quic
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("Client Multiplexer", func() {
It("adds a new packet conn ", func() {
conn := newMockPacketConn()
_, err := getMultiplexer().AddConn(conn, 8, nil)
Expect(err).ToNot(HaveOccurred())
})
It("errors when adding an existing conn with a different connection ID length", func() {
conn := newMockPacketConn()
_, err := getMultiplexer().AddConn(conn, 5, nil)
Expect(err).ToNot(HaveOccurred())
_, err = getMultiplexer().AddConn(conn, 6, nil)
Expect(err).To(MatchError("cannot use 6 byte connection IDs on a connection that is already using 5 byte connction IDs"))
})
It("errors when adding an existing conn with a different stateless rest key", func() {
conn := newMockPacketConn()
_, err := getMultiplexer().AddConn(conn, 7, []byte("foobar"))
Expect(err).ToNot(HaveOccurred())
_, err = getMultiplexer().AddConn(conn, 7, []byte("raboof"))
Expect(err).To(MatchError("cannot use different stateless reset keys on the same packet conn"))
})
})