summaryrefslogtreecommitdiff
path: root/test/parallel/test-net-dns-lookup.js
blob: 31576edd2b750378bb8bba2fcccce5979699f31d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
'use strict';
require('../common');
var assert = require('assert');
var net = require('net');
var ok = false;

var server = net.createServer(function(client) {
  client.end();
  server.close();
});

server.listen(0, '127.0.0.1', function() {
  net.connect(this.address().port, 'localhost')
    .on('lookup', function(err, ip, type, host) {
      assert.equal(err, null);
      assert.equal(ip, '127.0.0.1');
      assert.equal(type, '4');
      assert.equal(host, 'localhost');
      ok = true;
    });
});

process.on('exit', function() {
  assert(ok);
});