tests: add %NOLISTENPORT and use it

The purpose with this variable is to provide a port number that is
reasonably likely to not have a listener on the local host so that tests
can try connect failures against it. It uses port 47 - "reserved"
according to IANA.

Updated six tests to use it instead of the previous different ports.

Assisted-by: Emil Engler
Closes #5270
diff --git a/tests/FILEFORMAT.md b/tests/FILEFORMAT.md
index 586b84b..034b1a7 100644
--- a/tests/FILEFORMAT.md
+++ b/tests/FILEFORMAT.md
@@ -365,6 +365,7 @@
 - `%IMAPPORT` - Port number of the IMAP server
 - `%MQTTPORT` - Port number of the MQTT server
 - `%NEGTELNETPORT` - Port number of the telnet server
+- `%NOLISTENPORT` - Port number where no service is listening
 - `%POP36PORT` - IPv6 port number of the POP3 server
 - `%POP3PORT` - Port number of the POP3 server
 - `%POSIX_PWD` - Current directory somewhat mingw friendly
diff --git a/tests/data/test19 b/tests/data/test19
index 8e1bf5e..f053baf 100644
--- a/tests/data/test19
+++ b/tests/data/test19
@@ -24,7 +24,7 @@
 attempt connect to non-listening socket
  </name>
  <command>
-%HOSTIP:2
+%HOSTIP:%NOLISTENPORT
 </command>
 </client>
 
diff --git a/tests/data/test504 b/tests/data/test504
index 7c92209..be8f95e 100644
--- a/tests/data/test504
+++ b/tests/data/test504
@@ -32,7 +32,7 @@
 simple multi through local proxy without listener
  </name>
  <command>
-http://%HOSTIP:%HTTPSPORT/504 %HOSTIP:55555
+http://%HOSTIP:%HTTPSPORT/504 %HOSTIP:%NOLISTENPORT
 </command>
 </client>
 
diff --git a/tests/data/test702 b/tests/data/test702
index c037236..1c18d09 100644
--- a/tests/data/test702
+++ b/tests/data/test702
@@ -31,7 +31,7 @@
 Attempt connect to non-listening HTTP server via SOCKS4 proxy
  </name>
  <command>
---socks4 %HOSTIP:%SOCKSPORT http://%HOSTIP:60000
+--socks4 %HOSTIP:%SOCKSPORT http://%HOSTIP:%NOLISTENPORT
 </command>
 </client>
 
diff --git a/tests/data/test703 b/tests/data/test703
index 53d6a02..d7be713 100644
--- a/tests/data/test703
+++ b/tests/data/test703
@@ -31,7 +31,7 @@
 Attempt connect to non-listening HTTP server via SOCKS5 proxy
  </name>
  <command>
---socks5 %HOSTIP:%SOCKSPORT http://%HOSTIP:60000
+--socks5 %HOSTIP:%SOCKSPORT http://%HOSTIP:%NOLISTENPORT
 </command>
 </client>
 
diff --git a/tests/data/test704 b/tests/data/test704
index 7f891fa..9e821c6 100644
--- a/tests/data/test704
+++ b/tests/data/test704
@@ -23,7 +23,7 @@
 Attempt connect to non-listening SOCKS4 proxy
  </name>
  <command>
---socks4 %HOSTIP:2 http://%HOSTIP:%HTTPPORT/704
+--socks4 %HOSTIP:%NOLISTENPORT http://%HOSTIP:%HTTPPORT/704
 </command>
 <features>
 proxy
diff --git a/tests/data/test705 b/tests/data/test705
index cfbf341..e7ba012 100644
--- a/tests/data/test705
+++ b/tests/data/test705
@@ -23,7 +23,7 @@
 Attempt connect to non-listening SOCKS5 proxy
  </name>
  <command>
---socks5 %HOSTIP:2 http://%HOSTIP:%HTTPPORT/705
+--socks5 %HOSTIP:%NOLISTENPORT http://%HOSTIP:%HTTPPORT/705
 </command>
 <features>
 proxy
diff --git a/tests/runtests.pl b/tests/runtests.pl
index cd22cd3..cfc2c86 100755
--- a/tests/runtests.pl
+++ b/tests/runtests.pl
@@ -126,6 +126,7 @@
 
 my $noport="[not running]";
 
+my $NOLISTENPORT=47;     # port number we use for a local non-listening service
 my $MQTTPORT=$noport;    # MQTT server port
 my $HTTPPORT=$noport;    # HTTP server port
 my $HTTP6PORT=$noport;   # HTTP IPv6 server port
@@ -3229,6 +3230,7 @@
     $$thing =~ s/${prefix}SMBPORT/$SMBPORT/g;
     $$thing =~ s/${prefix}SMBSPORT/$SMBSPORT/g;
     $$thing =~ s/${prefix}NEGTELNETPORT/$NEGTELNETPORT/g;
+    $$thing =~ s/${prefix}NOLISTENPORT/$NOLISTENPORT/g;
 
     # server Unix domain socket paths
     $$thing =~ s/${prefix}HTTPUNIXPATH/$HTTPUNIXPATH/g;