def testPatronServiceEcho(self):
        """
        Test Patron service request response of echo non blocking
        """
        console.terse("{0}\n".format(self.testPatronServiceEcho.__doc__))



        wireLogAlpha = wiring.WireLog(buffify=True, same=True)
        result = wireLogAlpha.reopen()

        alpha = tcp.Server(port = 6101, bufsize=131072, wlog=wireLogAlpha)
        self.assertIs(alpha.reopen(), True)
        self.assertEqual(alpha.ha, ('0.0.0.0', 6101))
        self.assertEqual(alpha.eha, ('127.0.0.1', 6101))

        console.terse("{0}\n".format("Building Connector ...\n"))

        wireLogBeta = wiring.WireLog(buffify=True,  same=True)
        result = wireLogBeta.reopen()
        host = alpha.eha[0]
        port = alpha.eha[1]
        method = u'GET'
        path = u'/echo?name=fame'
        headers = odict([(u'Accept', u'application/json')])


        beta = clienting.Patron(bufsize=131072,
                              wlog=wireLogBeta,
                              hostname=host,
                              port=port,
                              method=method,
                              path=path,
                              headers=headers,
                              )

        self.assertIs(beta.connector.reopen(), True)
        self.assertIs(beta.connector.accepted, False)
        self.assertIs(beta.connector.connected, False)
        self.assertIs(beta.connector.cutoff, False)

        console.terse("Connecting beta to server ...\n")
        while True:
            beta.connector.serviceConnect()
            alpha.serviceConnects()
            if beta.connector.connected and beta.connector.ca in alpha.ixes:
                break
            time.sleep(0.05)

        self.assertIs(beta.connector.accepted, True)
        self.assertIs(beta.connector.connected, True)
        self.assertIs(beta.connector.cutoff, False)
        self.assertEqual(beta.connector.ca, beta.connector.cs.getsockname())
        self.assertEqual(beta.connector.ha, beta.connector.cs.getpeername())
        self.assertEqual(alpha.eha, beta.connector.ha)

        ixBeta = alpha.ixes[beta.connector.ca]
        self.assertIsNotNone(ixBeta.ca)
        self.assertIsNotNone(ixBeta.cs)
        self.assertEqual(ixBeta.cs.getsockname(), beta.connector.cs.getpeername())
        self.assertEqual(ixBeta.cs.getpeername(), beta.connector.cs.getsockname())
        self.assertEqual(ixBeta.ca, beta.connector.ca)
        self.assertEqual(ixBeta.ha, beta.connector.ha)

        beta.transmit()

        lines = [
                   b'GET /echo?name=fame HTTP/1.1',
                   b'Host: 127.0.0.1:6101',
                   b'Accept-Encoding: identity',
                   b'Accept: application/json',
                   b'',
                   b'',
                ]
        for i, line in enumerate(lines):
            self.assertEqual(line, beta.requester.lines[i])

        msgOut = beta.connector.txes[0]
        self.assertEqual(beta.requester.head, b'GET /echo?name=fame HTTP/1.1\r\nHost: 127.0.0.1:6101\r\nAccept-Encoding: identity\r\nAccept: application/json\r\n\r\n')
        self.assertEqual(msgOut, b'GET /echo?name=fame HTTP/1.1\r\nHost: 127.0.0.1:6101\r\nAccept-Encoding: identity\r\nAccept: application/json\r\n\r\n')

        console.terse("Beta requests to Alpha\n")
        console.terse("{0} from  {1}:{2}{3} ...\n".format(method, host, port, path))

        while beta.connector.txes and not ixBeta.rxbs :
            beta.serviceAll()
            time.sleep(0.05)
            alpha.serviceReceivesAllIx()
            time.sleep(0.05)
        msgIn = bytes(ixBeta.rxbs)
        self.assertEqual(msgIn, msgOut)
        ixBeta.clearRxbs()

        console.terse("Alpha responds to Beta\n")
        console.terse("Beta processes response \n")
        msgOut = b'HTTP/1.1 200 OK\r\nContent-Length: 122\r\nContent-Type: application/json\r\nDate: Thu, 30 Apr 2015 19:37:17 GMT\r\nServer: IoBook.local\r\n\r\n{"content": null, "query": {"name": "fame"}, "verb": "GET", "url": "http://127.0.0.1:8080/echo?name=fame", "action": null}'
        ixBeta.tx(msgOut)
        while ixBeta.txes or not beta.respondent.ended:
            alpha.serviceTxesAllIx()
            time.sleep(0.05)
            beta.serviceAll()
            time.sleep(0.05)

        self.assertEqual(len(beta.connector.rxbs), 0)
        self.assertIs(beta.waited, False)
        self.assertIs(beta.respondent.ended, True)
        self.assertEqual(len(beta.responses), 1)

        self.assertEqual(bytes(beta.respondent.body), b'')
        self.assertEqual(beta.respondent.data, {'action': None,
                                         'content': None,
                                         'query': {'name': 'fame'},
                                         'url': 'http://127.0.0.1:8080/echo?name=fame',
                                         'verb': 'GET'}
                         )
        self.assertEqual(len(beta.connector.rxbs), 0)
        self.assertEqual(beta.respondent.headers.items(), [('content-length', '122'),
                                                    ('content-type', 'application/json'),
                                                    ('date', 'Thu, 30 Apr 2015 19:37:17 GMT'),
                                                    ('server', 'IoBook.local')])

        alpha.close()
        beta.connector.close()

        wireLogAlpha.close()
        wireLogBeta.close()
dataset/ETHPy150Open ioflo/ioflo/ioflo/aio/http/test/test_clienting.py/BasicTestCase.testPatronServiceEcho/original