# Path: zoonado/protocol/connect.py
# class ConnectRequest(Request):
#     """
#     """
#     parts = (
#         ("protocol_version", Int),
#         ("last_seen_zxid", Long),
#         ("timeout", Int),
#         ("session_id", Long),
#         ("password", Buffer),
#         ("read_only", Bool),
#     )
# 
# class ConnectResponse(Response):
#     """
#     """
#     parts = (
#         ("protocol_version", Int),
#         ("timeout", Int),
#         ("session_id", Long),
#         ("password", Buffer),
#     )
# 
# Path: zoonado/connection.py
# class Connection(object):
#     def __init__(self, host, port, watch_handler):
#     def connect(self):
#     def send_connect(self, request):
#     def start_read_loop(self):
#     def send(self, request, xid=None):
#         def handle_write(write_future):
#     def read_loop(self):
#     def read_response(self, initial_connect=False):
#     def abort(self, exception=exc.ConnectError):
#         def abort_pending(f):
#     def drain_all_pending(self):
#     def close(self, timeout):


from mock import patch, Mock, call
from tornado import testing, concurrent
from zoonado.protocol.connect import ConnectRequest, ConnectResponse
from zoonado import connection
            return self.future_value(result)

        stream.write.return_value = self.future_value(None)
        stream.read_bytes.side_effect = read_some
        stream.read_until_close.side_effect = read_all

    def future_value(self, value):
        f = concurrent.Future()
        f.set_result(value)
        return f

    def future_error(self, exception):
        f = concurrent.Future()
        f.set_exception(exception)
        return f

    @testing.gen_test
    def test_connect_gets_version_info(self):
        self.response_buffer.extend(
            b"""Zookeeper version: 3.4.6-1569965, built on 02/20/2014 09:09 GMT
Latency min/avg/max: 0/0/1137
Received: 21462
Sent: 21474
Connections: 2
Outstanding: 0
Zxid: 0x11171
Mode: standalone
Node count: 232"""
        )


# Path: zoonado/protocol/connect.py
# class ConnectRequest(Request):
#     """
#     """
#     parts = (
#         ("protocol_version", Int),
#         ("last_seen_zxid", Long),
#         ("timeout", Int),
#         ("session_id", Long),
#         ("password", Buffer),
#         ("read_only", Bool),
#     )
# 
# class ConnectResponse(Response):
#     """
#     """
#     parts = (
#         ("protocol_version", Int),
#         ("timeout", Int),
#         ("session_id", Long),
#         ("password", Buffer),
#     )
# 
# Path: zoonado/connection.py
# class Connection(object):
#     def __init__(self, host, port, watch_handler):
#     def connect(self):
#     def send_connect(self, request):
#     def start_read_loop(self):
#     def send(self, request, xid=None):
#         def handle_write(write_future):
#     def read_loop(self):
#     def read_response(self, initial_connect=False):
#     def abort(self, exception=exc.ConnectError):
#         def abort_pending(f):
#     def drain_all_pending(self):
#     def close(self, timeout):


# Path: tests/test_connection.py
from mock import patch, Mock, call
from tornado import testing, concurrent
from zoonado.protocol.connect import ConnectRequest, ConnectResponse
from zoonado import connection

            return self.future_value(result)

        stream.write.return_value = self.future_value(None)
        stream.read_bytes.side_effect = read_some
        stream.read_until_close.side_effect = read_all

    def future_value(self, value):
        f = concurrent.Future()
        f.set_result(value)
        return f

    def future_error(self, exception):
        f = concurrent.Future()
        f.set_exception(exception)
        return f

    @testing.gen_test
    def test_connect_gets_version_info(self):
        self.response_buffer.extend(
            b"""Zookeeper version: 3.4.6-1569965, built on 02/20/2014 09:09 GMT
Latency min/avg/max: 0/0/1137
Received: 21462
Sent: 21474
Connections: 2
Outstanding: 0
Zxid: 0x11171
Mode: standalone
Node count: 232"""
        )


        conn = connection.Connection("local", 9999, Mock())