import sys
sys.path.append('../..')

import report
import helpers
import time


def mirror_callback(sock):
    sock.send(sock.receive())


report.stdoutLoggingConfigure(log_name_lvl=[('root', 'DEBUG'), ])
s = helpers.direct_socket_server(virtual_rate_bps=5)
s.init_channel_name('example_server')
s.register_callback(mirror_callback)
c = helpers.direct_socket_client(max_len=2, virtual_rate_bps=5)
c.init_channel_name('example_client')
c.connect(s)
c.send(b'abc')
print('The Client received: %s' % repr(c.receive()))
