Check once for TCP connection.
npm install tcp-connect
var tcp = require('tcp-connect');
tcp(google.com, 80, 1000)
.then(() => console.log('google.com is available'))
.catch(() => console.log('no luck this time'));
Tests are best run in docker:
docker-compose build
docker-compose run tcp-connect npm test