mirror of
https://github.com/refraction-networking/uquic.git
synced 2025-04-03 20:27:35 +03:00
expose the TransportError and the ApplicationError
This commit is contained in:
parent
f5238bf7b1
commit
42b61729bd
23 changed files with 126 additions and 106 deletions
|
@ -12,8 +12,8 @@ import (
|
|||
"github.com/lucas-clemente/quic-go"
|
||||
"github.com/lucas-clemente/quic-go/integrationtests/tools/israce"
|
||||
"github.com/lucas-clemente/quic-go/internal/protocol"
|
||||
"github.com/lucas-clemente/quic-go/internal/qerr"
|
||||
"github.com/lucas-clemente/quic-go/logging"
|
||||
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
)
|
||||
|
@ -269,7 +269,7 @@ var _ = Describe("Handshake tests", func() {
|
|||
clientConfig,
|
||||
)
|
||||
Expect(err).To(HaveOccurred())
|
||||
var transportErr *qerr.TransportError
|
||||
var transportErr *quic.TransportError
|
||||
Expect(errors.As(err, &transportErr)).To(BeTrue())
|
||||
Expect(transportErr.ErrorCode.IsCryptoError()).To(BeTrue())
|
||||
Expect(transportErr.Error()).To(ContainSubstring("x509: certificate is valid for localhost, not foo.bar"))
|
||||
|
@ -298,7 +298,7 @@ var _ = Describe("Handshake tests", func() {
|
|||
Eventually(errChan).Should(Receive(&err))
|
||||
}
|
||||
Expect(err).To(HaveOccurred())
|
||||
var transportErr *qerr.TransportError
|
||||
var transportErr *quic.TransportError
|
||||
Expect(errors.As(err, &transportErr)).To(BeTrue())
|
||||
Expect(transportErr.ErrorCode.IsCryptoError()).To(BeTrue())
|
||||
Expect(transportErr.Error()).To(ContainSubstring("tls: bad certificate"))
|
||||
|
@ -314,7 +314,7 @@ var _ = Describe("Handshake tests", func() {
|
|||
clientConfig,
|
||||
)
|
||||
Expect(err).To(HaveOccurred())
|
||||
var transportErr *qerr.TransportError
|
||||
var transportErr *quic.TransportError
|
||||
Expect(errors.As(err, &transportErr)).To(BeTrue())
|
||||
Expect(transportErr.ErrorCode.IsCryptoError()).To(BeTrue())
|
||||
Expect(transportErr.Error()).To(ContainSubstring("x509: certificate is valid for localhost, not foo.bar"))
|
||||
|
@ -376,9 +376,9 @@ var _ = Describe("Handshake tests", func() {
|
|||
|
||||
_, err := dial()
|
||||
Expect(err).To(HaveOccurred())
|
||||
var transportErr *qerr.TransportError
|
||||
var transportErr *quic.TransportError
|
||||
Expect(errors.As(err, &transportErr)).To(BeTrue())
|
||||
Expect(transportErr.ErrorCode).To(Equal(qerr.ConnectionRefused))
|
||||
Expect(transportErr.ErrorCode).To(Equal(quic.ConnectionRefused))
|
||||
|
||||
// now accept one session, freeing one spot in the queue
|
||||
_, err = server.Accept(context.Background())
|
||||
|
@ -392,7 +392,7 @@ var _ = Describe("Handshake tests", func() {
|
|||
_, err = dial()
|
||||
Expect(err).To(HaveOccurred())
|
||||
Expect(errors.As(err, &transportErr)).To(BeTrue())
|
||||
Expect(transportErr.ErrorCode).To(Equal(qerr.ConnectionRefused))
|
||||
Expect(transportErr.ErrorCode).To(Equal(quic.ConnectionRefused))
|
||||
})
|
||||
|
||||
It("removes closed connections from the accept queue", func() {
|
||||
|
@ -408,9 +408,9 @@ var _ = Describe("Handshake tests", func() {
|
|||
|
||||
_, err = dial()
|
||||
Expect(err).To(HaveOccurred())
|
||||
var transportErr *qerr.TransportError
|
||||
var transportErr *quic.TransportError
|
||||
Expect(errors.As(err, &transportErr)).To(BeTrue())
|
||||
Expect(transportErr.ErrorCode).To(Equal(qerr.ConnectionRefused))
|
||||
Expect(transportErr.ErrorCode).To(Equal(quic.ConnectionRefused))
|
||||
|
||||
// Now close the one of the session that are waiting to be accepted.
|
||||
// This should free one spot in the queue.
|
||||
|
@ -426,7 +426,7 @@ var _ = Describe("Handshake tests", func() {
|
|||
_, err = dial()
|
||||
Expect(err).To(HaveOccurred())
|
||||
Expect(errors.As(err, &transportErr)).To(BeTrue())
|
||||
Expect(transportErr.ErrorCode).To(Equal(qerr.ConnectionRefused))
|
||||
Expect(transportErr.ErrorCode).To(Equal(quic.ConnectionRefused))
|
||||
})
|
||||
})
|
||||
|
||||
|
@ -469,7 +469,7 @@ var _ = Describe("Handshake tests", func() {
|
|||
nil,
|
||||
)
|
||||
Expect(err).To(HaveOccurred())
|
||||
var transportErr *qerr.TransportError
|
||||
var transportErr *quic.TransportError
|
||||
Expect(errors.As(err, &transportErr)).To(BeTrue())
|
||||
Expect(transportErr.ErrorCode.IsCryptoError()).To(BeTrue())
|
||||
Expect(transportErr.Error()).To(ContainSubstring("no application protocol"))
|
||||
|
@ -550,9 +550,9 @@ var _ = Describe("Handshake tests", func() {
|
|||
nil,
|
||||
)
|
||||
Expect(err).To(HaveOccurred())
|
||||
var transportErr *qerr.TransportError
|
||||
var transportErr *quic.TransportError
|
||||
Expect(errors.As(err, &transportErr)).To(BeTrue())
|
||||
Expect(transportErr.ErrorCode).To(Equal(qerr.InvalidToken))
|
||||
Expect(transportErr.ErrorCode).To(Equal(quic.InvalidToken))
|
||||
// Receiving a Retry might lead the client to measure a very small RTT.
|
||||
// Then, it sometimes would retransmit the ClientHello before receiving the ServerHello.
|
||||
Expect(len(tokenChan)).To(BeNumerically(">=", 2))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue