|
|
@ -9,6 +9,7 @@ import (
|
|
|
|
func TestDial(t *testing.T) {
|
|
|
|
func TestDial(t *testing.T) {
|
|
|
|
//create a listener on a random port to make out test connection to
|
|
|
|
//create a listener on a random port to make out test connection to
|
|
|
|
listener, err := net.Listen("tcp", "127.0.0.1:0")
|
|
|
|
listener, err := net.Listen("tcp", "127.0.0.1:0")
|
|
|
|
|
|
|
|
t.Log("Test server listening on:", listener.Addr().String())
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
t.Fatal(err)
|
|
|
|
t.Fatal(err)
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -41,6 +42,7 @@ func TestDial(t *testing.T) {
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
// c.Read returns io.EOF when FIN packet (graceful termination) is received
|
|
|
|
// c.Read returns io.EOF when FIN packet (graceful termination) is received
|
|
|
|
if err != io.EOF {
|
|
|
|
if err != io.EOF {
|
|
|
|
|
|
|
|
t.Log("FIN packet received.")
|
|
|
|
t.Error(err)
|
|
|
|
t.Error(err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return
|
|
|
|
return
|
|
|
|