2021-06-09 09:42:31 +02:00
|
|
|
package dialer
|
2021-02-02 12:05:47 +01:00
|
|
|
|
|
|
|
import (
|
|
|
|
"net/http"
|
|
|
|
"testing"
|
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 TestShapingDialerGood(t *testing.T) {
|
2022-01-07 18:33:37 +01:00
|
|
|
d := &shapingDialer{Dialer: netxlite.DefaultDialer}
|
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("https://www.google.com/")
|
|
|
|
if err != nil {
|
|
|
|
t.Fatal(err)
|
|
|
|
}
|
|
|
|
if resp == nil {
|
|
|
|
t.Fatal("expected nil response here")
|
|
|
|
}
|
|
|
|
resp.Body.Close()
|
|
|
|
}
|