Fix tcpclient test when ipv6 is available but 'localhost' is only ipv4.
Raise StreamClosedError instead of IOError for ECONNRESET.

This allows application code to only catch one kind of exception
(an ECONNRESET exception is raised from
tornado.test.httpserver_test.KeepAliveTest.test_pipeline_cancel
on linux but not on mac)
Use Resolver instead of socket.getaddrinfo to decide whether localhost is ipv6.

The results can differ with different resolvers.  Add a CaresResolver
configuration to tox (it was already in travis).