Improve port finder

Previously, PortFinder used groovy's URL.getText() method to check if a port was open or not. This has certain problems, in that it involves an entire HTTP request/response pair, when all we really need is to know is if the port is in use or not. If an HTTP server happens to be listening on a port, and returns an error response, the getText method will throw an exception, which is not what we want. Rather, in that situation we would want to recognize only that the port is in use.

This pull request fixes the port search procedure by simply trying to connect a socket to a port, rather than making an HTTP request. That should make things less flaky. This pull request also adds tests for PortFinder, which were previously lacking.