
[Tim Peters]
... test_rude_shutdown() is dicey, relying on a sleep() instead of proper synchronization to make it probable that the `listener` thread goes away before the main thread tries to connect, but while that race may account for bogus TestFailed deaths, it doesn't seem possible that it could account for the kind of failure above.
Well, since it's silly to try to guess about one weird failure when a clear cause for another kind of weird failure is known, I checked in changes to do "proper" thread synchronization and termination in that test. Hasn't failed here since, but that's not surprising (it was always a "once in a light blue moon" kind of thing). I'm not sure how/whether this test is supposed to work with Jython -- perhaps the `thread.exit()` I removed could be important there. The test relies on that a socket gets closed when a socket object becomes trash & is reclaimed; in CPython that's easy to control; I don't know why the test didn't/doesn't simply do an explicit s.close() instead.