create Client in main package

This commit is contained in:
Marten Seemann 2016-11-07 17:51:39 +07:00
parent 6189df2d37
commit afa71d52f1
No known key found for this signature in database
GPG key ID: 3603F40B121FCDEA
3 changed files with 137 additions and 75 deletions

29
client_test.go Normal file
View file

@ -0,0 +1,29 @@
package quic
import (
"bytes"
"github.com/lucas-clemente/quic-go/protocol"
"github.com/lucas-clemente/quic-go/qerr"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("Client", func() {
var client *Client
BeforeEach(func() {
client = &Client{}
})
It("errors on invalid public header", func() {
err := client.handlePacket(nil)
Expect(err.(*qerr.QuicError).ErrorCode).To(Equal(qerr.InvalidPacketHeader))
})
It("errors on large packets", func() {
err := client.handlePacket(bytes.Repeat([]byte{'a'}, int(protocol.MaxPacketSize)+1))
Expect(err).To(MatchError(qerr.PacketTooLarge))
})
})