go 1.4 doesn't like closed connection, check we closed the listener
This commit is contained in:
parent
77177508ce
commit
fe1fde8c59
@ -52,6 +52,8 @@ func TestHTTPTransportCommunication(t *testing.T) {
|
|||||||
defer l.Close()
|
defer l.Close()
|
||||||
|
|
||||||
fn := func(sock transport.Socket) {
|
fn := func(sock transport.Socket) {
|
||||||
|
defer sock.Close()
|
||||||
|
|
||||||
for {
|
for {
|
||||||
var m transport.Message
|
var m transport.Message
|
||||||
if err := sock.Recv(&m); err != nil {
|
if err := sock.Recv(&m); err != nil {
|
||||||
@ -66,10 +68,16 @@ func TestHTTPTransportCommunication(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
done := make(chan bool)
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
if err := l.Accept(fn); err != nil {
|
if err := l.Accept(fn); err != nil {
|
||||||
|
select {
|
||||||
|
case <-done:
|
||||||
|
default:
|
||||||
t.Errorf("Unexpected accept err: %v", err)
|
t.Errorf("Unexpected accept err: %v", err)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
c, err := tr.Dial(l.Addr())
|
c, err := tr.Dial(l.Addr())
|
||||||
@ -98,4 +106,6 @@ func TestHTTPTransportCommunication(t *testing.T) {
|
|||||||
if string(rm.Body) != string(m.Body) {
|
if string(rm.Body) != string(m.Body) {
|
||||||
t.Errorf("Expected %v, got %v", m.Body, rm.Body)
|
t.Errorf("Expected %v, got %v", m.Body, rm.Body)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
close(done)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user