'This will prove that the timeout gets through
HTTPConnection and into the socket.'

def testTimeoutAttribute(self):

    self.assertIsNone(socket.getdefaulttimeout())
    socket.setdefaulttimeout(30)
    try:
        httpConn = httplib.HTTPConnection(HOST, TimeoutTest.PORT)
        httpConn.connect()
    finally:
        socket.setdefaulttimeout(None)
    self.assertEqual(httpConn.sock.gettimeout(), 30)
    httpConn.close()
    self.assertIsNone(socket.getdefaulttimeout())
    socket.setdefaulttimeout(30)
    try:
        httpConn = httplib.HTTPConnection(HOST, TimeoutTest.PORT, timeout=None)
        httpConn.connect()
    finally:
        socket.setdefaulttimeout(None)
    self.assertEqual(httpConn.sock.gettimeout(), None)
    httpConn.close()
    httpConn = httplib.HTTPConnection(HOST, TimeoutTest.PORT, timeout=30)
    httpConn.connect()
    self.assertEqual(httpConn.sock.gettimeout(), 30)
    httpConn.close()
