assert.strictEqual(address_ipv6.family, family_ipv6);
server_ipv6.close();
});
+
+// Test without hostname or ip
+var anycast_ipv6 = '::';
+var server1 = net.createServer();
+
+server1.on('error', function(e) {
+ console.log('Error on ip socket: ' + e.toString());
+});
+
+// Specify the port number
+server1.listen(common.PORT, function() {
+ var address = server1.address();
+ assert.strictEqual(address.address, anycast_ipv6);
+ assert.strictEqual(address.port, common.PORT);
+ assert.strictEqual(address.family, family_ipv6);
+ server1.close();
+});
+
+// Test without hostname or port
+var server2 = net.createServer();
+
+server2.on('error', function (e) {
+ console.log('Error on ip socket: ' + e.toString());
+});
+
+// Don't specify the port number
+server2.listen(function () {
+ var address = server2.address();
+ assert.strictEqual(address.address, anycast_ipv6);
+ assert.strictEqual(address.family, family_ipv6);
+ server2.close();
+});
+
+// Test without hostname, but with a false-y port
+var server3 = net.createServer();
+
+server3.on('error', function (e) {
+ console.log('Error on ip socket: ' + e.toString());
+});
+
+// Specify a false-y port number
+server3.listen(0, function () {
+ var address = server3.address();
+ assert.strictEqual(address.address, anycast_ipv6);
+ assert.strictEqual(address.family, family_ipv6);
+ server3.close();
+});
+
+// Test without hostname, but with port -1
+var server4 = net.createServer();
+
+server4.on('error', function (e) {
+ console.log('Error on ip socket: ' + e.toString());
+});
+
+// Specify -1 as port number
+server4.listen(-1, function () {
+ var address = server4.address();
+ assert.strictEqual(address.address, anycast_ipv6);
+ assert.strictEqual(address.family, family_ipv6);
+ server4.close();
+});