use cryptographic random to generate new connection IDs

fixes #348
This commit is contained in:
Marten Seemann
2017-01-18 14:19:53 +07:00
parent d5ec70fc7d
commit 86e02c4d2c
3 changed files with 39 additions and 4 deletions

View File

@@ -0,0 +1,17 @@
package utils
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("Connection ID generation", func() {
It("generates random connection IDs", func() {
c1, err := GenerateConnectionID()
Expect(err).ToNot(HaveOccurred())
Expect(c1).ToNot(BeZero())
c2, err := GenerateConnectionID()
Expect(err).ToNot(HaveOccurred())
Expect(c1).ToNot(Equal(c2))
})
})