Skip to content

Commit

Permalink
Add panic test
Browse files Browse the repository at this point in the history
  • Loading branch information
mingyech committed Jan 18, 2025
1 parent 98f5a5d commit a741f02
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions u_parrot_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
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.Millisecond*100)
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)
}

}

0 comments on commit a741f02

Please sign in to comment.