1 var common = require('../common');
2 var http = require('http'),
3 assert = require('assert');
5 if (!common.hasMultiLocalhost()) {
6 console.log('Skipping platform-specific test.');
10 var server = http.createServer(function (req, res) {
11 console.log("Connect from: " + req.connection.remoteAddress);
12 assert.equal('127.0.0.2', req.connection.remoteAddress);
14 req.on('end', function() {
15 res.writeHead(200, { 'Content-Type': 'text/plain' });
16 res.end('You are from: ' + req.connection.remoteAddress);
21 server.listen(common.PORT, "127.0.0.1", function() {
22 var options = { host: 'localhost',
26 localAddress: '127.0.0.2' };
28 var req = http.request(options, function(res) {
29 res.on('end', function() {