mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
net: use IANA reserved port to test dial timeout
R=golang-dev, rsc CC=golang-dev https://golang.org/cl/5757060
This commit is contained in:
parent
4267974c0b
commit
ae7a843471
1 changed files with 5 additions and 2 deletions
|
|
@ -51,12 +51,15 @@ func TestDialTimeout(t *testing.T) {
|
||||||
// to connecting to a hopefully-dead 127/8 address.
|
// to connecting to a hopefully-dead 127/8 address.
|
||||||
// Same for windows.
|
// Same for windows.
|
||||||
//
|
//
|
||||||
// Use a bogus port (44444) instead of 80, because
|
// Use an IANA reserved port (49151) instead of 80, because
|
||||||
// on our 386 builder, this Dial succeeds, connecting
|
// on our 386 builder, this Dial succeeds, connecting
|
||||||
// to an IIS web server somewhere. The data center
|
// to an IIS web server somewhere. The data center
|
||||||
// or VM or firewall must be stealing the TCP connection.
|
// or VM or firewall must be stealing the TCP connection.
|
||||||
|
//
|
||||||
|
// IANA Service Name and Transport Protocol Port Number Registry
|
||||||
|
// <http://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xml>
|
||||||
go func() {
|
go func() {
|
||||||
c, err := DialTimeout("tcp", "127.0.71.111:44444", 200*time.Millisecond)
|
c, err := DialTimeout("tcp", "127.0.71.111:49151", 200*time.Millisecond)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
err = fmt.Errorf("unexpected: connected to %s!", c.RemoteAddr())
|
err = fmt.Errorf("unexpected: connected to %s!", c.RemoteAddr())
|
||||||
c.Close()
|
c.Close()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue