mirror of
https://github.com/refraction-networking/uquic.git
synced 2025-03-31 10:47:35 +03:00
38 lines
694 B
Go
38 lines
694 B
Go
package quic
|
|
|
|
import (
|
|
"context"
|
|
"net"
|
|
"testing"
|
|
"time"
|
|
|
|
tls "github.com/refraction-networking/utls"
|
|
)
|
|
|
|
func testDialPanic(t *testing.T, id QUICID) {
|
|
|
|
quicSpec, err := QUICID2Spec(id)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
|
|
pktConn, err := net.ListenUDP("udp", nil)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
|
|
tr := &UTransport{Transport: &Transport{Conn: pktConn}, QUICSpec: &quicSpec}
|
|
|
|
ctx, cancel := context.WithTimeout(context.Background(), time.Second)
|
|
defer cancel()
|
|
tr.Dial(ctx, &net.UDPAddr{IP: net.IP{127, 0, 0, 1}, Port: 1234}, &tls.Config{}, &Config{})
|
|
|
|
}
|
|
|
|
func TestDialPanic(t *testing.T) {
|
|
|
|
for _, s := range []QUICID{QUICChrome_115, QUICFirefox_116} {
|
|
testDialPanic(t, s)
|
|
}
|
|
|
|
}
|