ooni-probe-cli/internal/engine/netx/tlsdialer/integration_test.go
Simone Basso 7a9499fee3
refactor(dialer): it should close idle connections (#457)
Like we did before for the resolver, a dialer should propagate the
request to close idle connections to underlying types.

See https://github.com/ooni/probe/issues/1591
2021-09-05 19:55:28 +02:00

33 lines
715 B
Go

package tlsdialer_test
import (
"net/http"
"testing"
"github.com/apex/log"
"github.com/ooni/probe-cli/v3/internal/netxlite"
)
func TestTLSDialerSuccess(t *testing.T) {
if testing.Short() {
t.Skip("skip test in short mode")
}
log.SetLevel(log.DebugLevel)
dialer := &netxlite.TLSDialer{Dialer: netxlite.DefaultDialer,
TLSHandshaker: &netxlite.TLSHandshakerLogger{
TLSHandshaker: &netxlite.TLSHandshakerConfigurable{},
Logger: log.Log,
},
}
txp := &http.Transport{
DialTLSContext: dialer.DialTLSContext,
ForceAttemptHTTP2: true,
}
client := &http.Client{Transport: txp}
resp, err := client.Get("https://www.google.com")
if err != nil {
t.Fatal(err)
}
resp.Body.Close()
}