refactor: move base http3 transport into netxlite (#412)
This diff is part of https://github.com/ooni/probe/issues/1505. You will notice that I have not adapted all the (great) tests we had previously. They should live at another layer, and namely the one that deals with performing measurements. When I'm refactoring such a layer I'll ensure those tests that I have not adapted here are reintroduced into the tree.
This commit is contained in:
parent
527e1a0707
commit
4dc2907472
6 changed files with 87 additions and 196 deletions
25
internal/netxlite/http3_test.go
Normal file
25
internal/netxlite/http3_test.go
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
package netxlite
|
||||
|
||||
import (
|
||||
"crypto/tls"
|
||||
"net"
|
||||
"net/http"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestHTTP3TransportWorks(t *testing.T) {
|
||||
d := &QUICDialerResolver{
|
||||
Dialer: &QUICDialerQUICGo{
|
||||
QUICListener: &QUICListenerStdlib{},
|
||||
},
|
||||
Resolver: &net.Resolver{},
|
||||
}
|
||||
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()
|
||||
}
|
||||
Loading…
Reference in a new issue