• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1'use strict';
2const common = require('../common');
3const assert = require('assert');
4const net = require('net');
5
6const server = net.createServer(function(socket) {
7  assert.strictEqual(socket.remotePort, common.PORT);
8  socket.end();
9  socket.on('close', function() {
10    server.close();
11  });
12}).listen(0).on('listening', function() {
13  const client = net.connect({
14    host: '127.0.0.1',
15    port: this.address().port,
16    localPort: common.PORT,
17  }).on('connect', function() {
18    assert.strictEqual(client.localPort, common.PORT);
19  });
20});
21