1 // Copyright 2016 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
17 // See golang.org/issue/14548.
18 func TestTCPSpuriousConnSetupCompletion(t
*testing
.T
) {
20 t
.Skip("skipping in short mode")
23 ln
, err
:= newLocalListener("tcp")
29 go func(ln Listener
) {
46 attempts
:= int(1e4
) // larger is better
48 throttle
:= make(chan struct{}, runtime
.GOMAXPROCS(-1)*2)
49 for i
:= 0; i
< attempts
; i
++ {
50 throttle
<- struct{}{}
56 d
:= Dialer
{Timeout
: 50 * time
.Millisecond
}
57 c
, err
:= d
.Dial(ln
.Addr().Network(), ln
.Addr().String())
59 if perr
:= parseDialError(err
); perr
!= nil {
60 t
.Errorf("#%d: %v (original error: %v)", i
, perr
, err
)
65 if _
, err
:= c
.Write(b
[:]); err
!= nil {
66 if perr
:= parseWriteError(err
); perr
!= nil {
67 t
.Errorf("#%d: %v", i
, err
)
69 if samePlatformError(err
, syscall
.ENOTCONN
) {
70 t
.Errorf("#%d: %v", i
, err
)