Let's assum I have a basic HTTP server, like the one on nodejs.org:
var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello World\n');
}).listen(1337, '127.0.0.1');
console.log('Server running at http://127.0.0.1:1337/');
Is is it possible to simulate a connection to this server without using any npm module (socket.io, connect etc.) ?
The only way I have found by only using pure Node.js is by using http.request and running both the instances locally (both the server and the client simulator). However, I am unsure as to what drawbacks this has or if it is a valid option. Will this work if I try to simulate multiple connections, for example? Is network speed a bottleneck in this case? Is there a better/easier way?
Sure, you can make an HTTP request from within your computer, you won't be simulating it either, you'll be making an actual connection too. NodeJS's built in http module ships with a client as well as a server.
var http = require("http");
http.get("http://localhost:1337", function(resp){
console.log("Request made!", resp);
});