better error handling

pull/314/head
Darien Raymond 8 years ago
parent 85da0dae28
commit 90504fc077
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169

@ -1,9 +1,9 @@
package scenarios
import (
"fmt"
"net"
"testing"
"v2ray.com/core/common/alloc"
v2net "v2ray.com/core/common/net"
"v2ray.com/core/testing/assert"
@ -44,16 +44,21 @@ func TestShadowsocksTCP(t *testing.T) {
response := alloc.NewBuffer().Clear()
finished := false
expectedResponse := "Processed: " + payload
for {
_, err := response.FillFrom(conn)
assert.Error(err).IsNil()
if err != nil {
break
}
if response.String() == "Processed: "+payload {
if response.String() == expectedResponse {
finished = true
break
}
if response.Len() > len(expectedResponse) {
fmt.Printf("Unexpected response: %s\n", response.String())
break
}
}
assert.Bool(finished).IsTrue()

Loading…
Cancel
Save