1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-11-09 11:51:02 -05:00
v2fly/proxy/vmess/command/dns_test.go

31 lines
703 B
Go
Raw Normal View History

2015-12-24 19:07:42 -05:00
package command_test
import (
"testing"
"github.com/v2ray/v2ray-core/common/alloc"
v2net "github.com/v2ray/v2ray-core/common/net"
netassert "github.com/v2ray/v2ray-core/common/net/testing/assert"
. "github.com/v2ray/v2ray-core/proxy/vmess/command"
v2testing "github.com/v2ray/v2ray-core/testing"
"github.com/v2ray/v2ray-core/testing/assert"
)
func TestCacheDnsIPv4(t *testing.T) {
v2testing.Current(t)
cd := &CacheDns{
Address: v2net.IPAddress([]byte{1, 2, 3, 4}),
}
buffer := alloc.NewBuffer().Clear()
defer buffer.Release()
2016-01-19 17:41:40 -05:00
cd.Marshal(buffer)
2015-12-24 19:07:42 -05:00
cd2 := &CacheDns{}
2016-01-19 17:41:40 -05:00
err := cd2.Unmarshal(buffer.Value)
2015-12-24 19:07:42 -05:00
assert.Error(err).IsNil()
netassert.Address(cd.Address).Equals(cd2.Address)
}