forked from quic-go/quic-go
30
handshake/ephermal_cache_test.go
Normal file
30
handshake/ephermal_cache_test.go
Normal file
@@ -0,0 +1,30 @@
|
||||
package handshake
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/lucas-clemente/quic-go/crypto"
|
||||
"github.com/lucas-clemente/quic-go/protocol"
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
)
|
||||
|
||||
var _ = Describe("Ephermal KEX", func() {
|
||||
It("has a consistent KEX", func() {
|
||||
kex1 := getEphermalKEX()
|
||||
Expect(kex1).ToNot(BeNil())
|
||||
kex2 := getEphermalKEX()
|
||||
Expect(kex2).ToNot(BeNil())
|
||||
Expect(kex1).To(Equal(kex2))
|
||||
})
|
||||
|
||||
It("changes KEX", func() {
|
||||
kexLifetime = time.Millisecond
|
||||
defer func() {
|
||||
kexLifetime = protocol.EphermalKeyLifetime
|
||||
}()
|
||||
kex := getEphermalKEX()
|
||||
Expect(kex).ToNot(BeNil())
|
||||
Eventually(func() crypto.KeyExchange { return getEphermalKEX() }).ShouldNot(Equal(kex))
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user