2021-02-02 12:05:47 +01:00
|
|
|
package dialer_test
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net/http"
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/apex/log"
|
|
|
|
"github.com/ooni/probe-cli/v3/internal/engine/netx/dialer"
|
2022-01-07 18:33:37 +01:00
|
|
|
"github.com/ooni/probe-cli/v3/internal/netxlite"
|
2021-02-02 12:05:47 +01:00
|
|
|
)
|
|
|
|
|
2021-06-09 09:42:31 +02:00
|
|
|
func TestDialerNewSuccess(t *testing.T) {
|
2021-02-02 12:05:47 +01:00
|
|
|
if testing.Short() {
|
|
|
|
t.Skip("skip test in short mode")
|
|
|
|
}
|
|
|
|
log.SetLevel(log.DebugLevel)
|
2022-01-07 18:33:37 +01:00
|
|
|
d := dialer.New(&dialer.Config{Logger: log.Log}, netxlite.DefaultResolver)
|
2021-06-09 09:42:31 +02:00
|
|
|
txp := &http.Transport{DialContext: d.DialContext}
|
2021-02-02 12:05:47 +01:00
|
|
|
client := &http.Client{Transport: txp}
|
|
|
|
resp, err := client.Get("http://www.google.com")
|
|
|
|
if err != nil {
|
|
|
|
t.Fatal(err)
|
|
|
|
}
|
|
|
|
resp.Body.Close()
|
|
|
|
}
|