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