def testPatronPipelineEcho(self):
        """
        Test Patron pipeline servicing
        """
        console.terse("{0}\n".format(self.testPatronPipelineEcho.__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]

        beta = clienting.Patron(bufsize=131072,
                                     wlog=wireLogBeta,
                                     hostname=host,
                                     port=port,
                                     reconnectable=True,
                                     )

        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 alpha.ixes in beta.connector.ca:
                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)

        request = odict([('method', u'GET'),
                         ('path', u'/echo?name=fame'),
                         ('qargs', odict()),
                         ('fragment', u''),
                         ('headers', odict([('Accept', 'application/json')])),
                         ('body', None),
                        ])

        beta.requests.append(request)

        console.terse("Beta requests to Alpha\n")
        console.terse("from {0}:{1}, {2} {3} ...\n".format(beta.connector.ha[0],
                                                         beta.connector.ha[1],
                                                         request['method'],
                                                         request['path']))

        while (beta.requests or beta.connector.txes) and not ixBeta.rxbs :
            beta.serviceAll()
            time.sleep(0.05)
            alpha.serviceReceivesAllIx()
            time.sleep(0.05)
        msgIn = bytes(ixBeta.rxbs)
        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'
        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)
        response = beta.responses.popleft()
        self.assertEqual(response, {'version': (1, 1),
                                    'status': 200,
                                    'reason': 'OK',
                                    'headers':
                                        {'content-length': '122',
                                        'content-type': 'application/json',
                                        'date': 'Thu, 30 Apr 2015 19:37:17 GMT',
                                        'server': 'IoBook.local'},
                                    'body': bytearray(b''),
                                    'data': {'action': None,
                                             'content': None,
                                             'query': {'name': 'fame'},
                                             'url': 'http://127.0.0.1:8080/echo?name=fame',
                                             'verb': 'GET'},
                                    'error': None,
                                    'errored': False,
                                    'request':
                                        {'host': '127.0.0.1',
                                         'port': 6101,
                                         'scheme': 'http',
                                         'method': 'GET',
                                         'path': '/echo',
                                         'qargs': {'name': 'fame'},
                                         'fragment': '',
                                         'headers':
                                             {'accept': 'application/json'},
                                         'body': b'',
                                         'data': None,
                                         'fargs': None,
                                        }
                                    })

        beta.requests.append(request)

        console.terse("\nBeta requests to Alpha again\n")
        console.terse("from {0}:{1}, {2} {3} ...\n".format(beta.connector.ha[0],
                                                           beta.connector.ha[1],
                                                           request['method'],
                                                           request['path']))

        while ( beta.requests or beta.connector.txes) and not ixBeta.rxbs :
            beta.serviceAll()
            time.sleep(0.05)
            alpha.serviceReceivesAllIx()
            time.sleep(0.05)
        msgIn = bytes(ixBeta.rxbs)
        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'
        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)
        response = beta.responses.popleft()
        self.assertEqual(response, {'version': (1, 1),
                                    'status': 200,
                                    'reason': 'OK',
                                    'headers':
                                        {'content-length': '122',
                                         'content-type': 'application/json',
                                         'date': 'Thu, 30 Apr 2015 19:37:17 GMT',
                                         'server': 'IoBook.local'},
                                    'body': bytearray(b''),
                                    'data': {'action': None,
                                             'content': None,
                                             'query': {'name': 'fame'},
                                             'url': 'http://127.0.0.1:8080/echo?name=fame',
                                             'verb': 'GET'},
                                    'error': None,
                                    'errored': False,
                                    'request': {'host': '127.0.0.1',
                                                'port': 6101,
                                                'scheme': 'http',
                                                'method': 'GET',
                                                'path': '/echo',
                                                'qargs': {'name': 'fame'},
                                                'fragment': '',
                                                'headers': {'accept': 'application/json'},
                                                'body': b'',
                                                'data': None,
                                                'fargs': None,
                                                }
                                    })

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

        wireLogAlpha.close()
        wireLogBeta.close()
dataset/ETHPy150Open ioflo/ioflo/ioflo/aio/http/test/test_clienting.py/BasicTestCase.testPatronPipelineEcho/swapped operands of `in`