Backport some missed code for handling conn resets

See https://github.com/python/cpython/blob/master/Lib/test/test_ssl.py#L1589