Use a socket connection instead of toURL.
Add proper tests for PortFinder.