tarcieri/nio4r — pull request #5 by loganb (2012-05-06 23:43:19+00:00)
Title: Remove hardcoded port offsets

Hello,

The tests in tcp_socket_spec use hard-coded port offsets. I was adding another test (pull request TBD), and this breaks because if you attempt to use a method that was used in a previous test (e.g. readable_subject), the old socket will still be open and on OS X the test will hang forever.

Almost straight out of the rspec docs, this change memoizes a unique port offset for each test run.