1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-07-07 05:44:28 -04:00
v2fly/transport/internet/tcp/sockopt_linux_test.go

29 lines
571 B
Go
Raw Normal View History

2017-04-18 06:02:43 -04:00
// +build linux
package tcp_test
import (
"context"
"testing"
"v2ray.com/core/testing/assert"
"v2ray.com/core/testing/servers/tcp"
2017-04-18 06:12:17 -04:00
. "v2ray.com/core/transport/internet/tcp"
2017-04-18 06:02:43 -04:00
)
func TestGetOriginalDestination(t *testing.T) {
assert := assert.On(t)
2017-04-18 06:12:17 -04:00
tcpServer := tcp.Server{}
2017-04-18 06:02:43 -04:00
dest, err := tcpServer.Start()
assert.Error(err).IsNil()
defer tcpServer.Close()
2017-04-18 07:02:42 -04:00
conn, err := Dial(context.Background(), dest)
2017-04-18 06:02:43 -04:00
assert.Error(err).IsNil()
2017-04-18 06:12:17 -04:00
defer conn.Close()
2017-04-18 06:02:43 -04:00
2017-04-18 06:20:46 -04:00
_, err = GetOriginalDestination(conn)
2017-04-18 06:02:43 -04:00
assert.String(err.Error()).Contains("failed to call getsockopt")
}