|
|
@ -85,20 +85,20 @@ func TestUDPServer(t *testing.T) {
|
|
|
|
common.Must(space.Initialize())
|
|
|
|
common.Must(space.Initialize())
|
|
|
|
common.Must(space.Start())
|
|
|
|
common.Must(space.Start())
|
|
|
|
|
|
|
|
|
|
|
|
server := FromSpace(space)
|
|
|
|
ips, err := net.LookupIP("google.com")
|
|
|
|
assert(server, IsNotNil)
|
|
|
|
assert(err, IsNil)
|
|
|
|
|
|
|
|
|
|
|
|
ips := server.Get("google.com")
|
|
|
|
|
|
|
|
assert(len(ips), Equals, 1)
|
|
|
|
assert(len(ips), Equals, 1)
|
|
|
|
assert([]byte(ips[0]), Equals, []byte{8, 8, 8, 8})
|
|
|
|
assert([]byte(ips[0]), Equals, []byte{8, 8, 8, 8})
|
|
|
|
|
|
|
|
|
|
|
|
ips = server.Get("facebook.com")
|
|
|
|
ips, err = net.LookupIP("facebook.com")
|
|
|
|
|
|
|
|
assert(err, IsNil)
|
|
|
|
assert(len(ips), Equals, 1)
|
|
|
|
assert(len(ips), Equals, 1)
|
|
|
|
assert([]byte(ips[0]), Equals, []byte{9, 9, 9, 9})
|
|
|
|
assert([]byte(ips[0]), Equals, []byte{9, 9, 9, 9})
|
|
|
|
|
|
|
|
|
|
|
|
dnsServer.Shutdown()
|
|
|
|
dnsServer.Shutdown()
|
|
|
|
|
|
|
|
|
|
|
|
ips = server.Get("google.com")
|
|
|
|
ips, err = net.LookupIP("google.com")
|
|
|
|
|
|
|
|
assert(err, IsNil)
|
|
|
|
assert(len(ips), Equals, 1)
|
|
|
|
assert(len(ips), Equals, 1)
|
|
|
|
assert([]byte(ips[0]), Equals, []byte{8, 8, 8, 8})
|
|
|
|
assert([]byte(ips[0]), Equals, []byte{8, 8, 8, 8})
|
|
|
|
}
|
|
|
|
}
|
|
|
|