http3: use actual QUIC connection in transport tests (#5164)

This commit is contained in:
Marten Seemann
2025-05-29 21:10:30 +08:00
committed by GitHub
parent 4e81b28694
commit d9528a5643
2 changed files with 30 additions and 29 deletions

View File

@@ -72,10 +72,10 @@ func init() {
func getTLSConfig() *tls.Config { return tlsConfig.Clone() }
func getTLSClientConfig() *tls.Config { return tlsClientConfig.Clone() }
func newConnPair(t *testing.T) (client, server quic.Connection) {
func newConnPair(t *testing.T) (client, server quic.EarlyConnection) {
t.Helper()
ln, err := quic.Listen(
ln, err := quic.ListenEarly(
newUDPConnLocalhost(t),
getTLSConfig(),
&quic.Config{
@@ -87,7 +87,7 @@ func newConnPair(t *testing.T) (client, server quic.Connection) {
ctx, cancel := context.WithTimeout(context.Background(), time.Second)
defer cancel()
cl, err := quic.Dial(ctx, newUDPConnLocalhost(t), ln.Addr(), getTLSClientConfig(), &quic.Config{})
cl, err := quic.DialEarly(ctx, newUDPConnLocalhost(t), ln.Addr(), getTLSClientConfig(), &quic.Config{})
require.NoError(t, err)
t.Cleanup(func() { cl.CloseWithError(0, "") })
@@ -97,10 +97,10 @@ func newConnPair(t *testing.T) (client, server quic.Connection) {
return cl, conn
}
func newConnPairWithDatagrams(t *testing.T) (client, server quic.Connection) {
func newConnPairWithDatagrams(t *testing.T) (client, server quic.EarlyConnection) {
t.Helper()
ln, err := quic.Listen(
ln, err := quic.ListenEarly(
newUDPConnLocalhost(t),
getTLSConfig(),
&quic.Config{
@@ -113,7 +113,7 @@ func newConnPairWithDatagrams(t *testing.T) (client, server quic.Connection) {
ctx, cancel := context.WithTimeout(context.Background(), time.Second)
defer cancel()
cl, err := quic.Dial(ctx, newUDPConnLocalhost(t), ln.Addr(), getTLSClientConfig(), &quic.Config{EnableDatagrams: true})
cl, err := quic.DialEarly(ctx, newUDPConnLocalhost(t), ln.Addr(), getTLSClientConfig(), &quic.Config{EnableDatagrams: true})
require.NoError(t, err)
t.Cleanup(func() { cl.CloseWithError(0, "") })