Reject connections from remote ports not in the specified range

* Add a test case (remote-port-range.py) that tests this scenario.
* Fix the code responsible for checking the port range.
* Ensure that rejected connections are closed using RST instead of FIN
so that the client gets a connection reset error.