Re:

> Any thoughts or suggestion how to isolate the random failure?

You may be able to use wireshark to see if the connection is indeed being reset.
May want to submit a bug report of it to the ruby bug tracker.
What version of OpenSSL are you using?
-=R