jclouds/jclouds — pull request #1009 by demobox (2012-11-28 02:13:04+00:00)
Title: Refactoring ConcurrentOpenSocketFinderTest.testChecksSocketsConcurrently

See https://groups.google.com/forum/?fromgroups=#!topic/jclouds-dev/A0wzG55YrHI

The new version of the test is based on the assumption that it's trying to verify

1. That the finder returns the *first** open socket
2. That the finder tries the sockets concurrently and not one after the other

The idea is as follows:

* both sockets are open, so if the finder returns a random one or the last one, the result will be wrong
* the cumulative time taken to test the sockets one after the other is greater than the finder's timeout, so one-by-one testing should sometimes fail

The _sometimes_ in the last bullet is not very satisfying, but since the order in which the sockets will be tried can't be rigged in the test class (it's a `Set` constructed in the finder) there doesn't seem to be much we can do about that.