netcat to test TCP connection
netcat or nc is a great tool to check TCP connections.
# listen on the port 80 to simulate
nc -l 80
# test open ports in a range
nc -zv localhost 80-81
# Connection to localhost port 80 [tcp/http] succeeded!
# nc: connectx to localhost port 81 (tcp) failed: Connection refused
# nc: connectx to localhost port 81 (tcp) failed: Connection refused