2021-06-30 15:19:10 +02:00
|
|
|
package netxlite
|
|
|
|
|
|
|
|
import (
|
|
|
|
"crypto/tls"
|
|
|
|
"net/http"
|
|
|
|
"testing"
|
2021-09-05 18:03:50 +02:00
|
|
|
|
|
|
|
"github.com/apex/log"
|
2021-06-30 15:19:10 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestHTTP3TransportWorks(t *testing.T) {
|
2021-09-05 14:49:38 +02:00
|
|
|
d := &quicDialerResolver{
|
|
|
|
Dialer: &quicDialerQUICGo{
|
|
|
|
QUICListener: &quicListenerStdlib{},
|
2021-06-30 15:19:10 +02:00
|
|
|
},
|
2021-09-05 18:03:50 +02:00
|
|
|
Resolver: NewResolver(&ResolverConfig{Logger: log.Log}),
|
2021-06-30 15:19:10 +02:00
|
|
|
}
|
|
|
|
txp := NewHTTP3Transport(d, &tls.Config{})
|
|
|
|
client := &http.Client{Transport: txp}
|
|
|
|
resp, err := client.Get("https://www.google.com/robots.txt")
|
|
|
|
if err != nil {
|
|
|
|
t.Fatal(err)
|
|
|
|
}
|
|
|
|
resp.Body.Close()
|
|
|
|
txp.CloseIdleConnections()
|
|
|
|
}
|