Made TorrentCollecting unit test use random ports.
Small fixes for unit tests.
Merge pull request #321 from lfei815/unit-test-random-port

Made TorrentCollecting unit test use random ports.