'Return True if the socket is still connected
to the server, False otherwise.
This check is done in 3 steps:
1 - Check if we have closed the connection
2 - Check if the original socket connection failed
3 - Check if the server has returned any data. If they have,
assume that the server closed the response after they sent
the data, i.e. that the data was the HTTP response.'

def _isconnected(self):

    if self._closed:
        return False
    if (self._conn.sock is None):
        return False
    try:
        self._bytes = six.b('')
        self._bytes = self._conn.sock.recv(1)
        return False
    except http_client.socket.error as e:
        if ((e.errno == 35) or (e.errno == 10035)):
            return True
        elif ((e.errno == 54) or (e.errno == 10054)):
            return False
        elif (e.errno == 11):
            return True
        elif isinstance(e, ssl.SSLError):
            if (e.errno == 2):
                return True
            raise e
        else:
            raise e
