diff options
Diffstat (limited to 'src/pkg/net/timeout_test.go')
-rw-r--r-- | src/pkg/net/timeout_test.go | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/src/pkg/net/timeout_test.go b/src/pkg/net/timeout_test.go index 092781685..09a257dc8 100644 --- a/src/pkg/net/timeout_test.go +++ b/src/pkg/net/timeout_test.go @@ -8,14 +8,9 @@ import ( "os" "testing" "time" - "runtime" ) func testTimeout(t *testing.T, network, addr string, readFrom bool) { - // Timeouts are not implemented on windows. - if runtime.GOOS == "windows" { - return - } fd, err := Dial(network, "", addr) if err != nil { t.Errorf("dial %s %s failed: %v", network, addr, err) @@ -51,8 +46,12 @@ func TestTimeoutUDP(t *testing.T) { } func TestTimeoutTCP(t *testing.T) { - // 74.125.19.99 is www.google.com. - // could use dns, but dns depends on - // timeouts and this is the timeout test. - testTimeout(t, "tcp", "74.125.19.99:80", false) + // set up a listener that won't talk back + listening := make(chan string) + done := make(chan int) + go runServe(t, "tcp", "127.0.0.1:0", listening, done) + addr := <-listening + + testTimeout(t, "tcp", addr, false) + <-done } |