'Test the connection is cleaned up when the response is closed'

def test_http_closed(self):

    for (transfer, data) in (('Connection:    close', 'data'), ('Transfer-Encoding:    chunked', '4\r\ndata\r\n0\r\n\r\n'), ('Content-Length:    4', 'data')):
        header = 'HTTP/1.1    200    OK\r\n{}\r\n\r\n'.format(transfer)
        conn = test_urllib.fakehttp((header.encode() + data))
        handler = urllib.request.AbstractHTTPHandler()
        req = Request('http://dummy/')
        req.timeout = None
        with handler.do_open(conn, req) as resp:
            resp.read()
        self.assertTrue(conn.fakesock.closed, 'Connection    not    closed    with    {!r}'.format(transfer))
