def server(): data = yield tb.read(4) self.assertEqual(data, b'AAAA') yield tb.write(b'OK') data = yield tb.read(4) self.assertEqual(data, b'BBBB') yield tb.write(b'SPAM')
def server(): yield tb.starttls(sslctx, server_side=True) data = yield tb.read(len(A_DATA)) self.assertEqual(data, A_DATA) yield tb.write(b'OK') data = yield tb.read(len(B_DATA)) self.assertEqual(data, B_DATA) yield tb.write(b'SPAM') yield tb.close()
def server(): yield tb.starttls( sslctx, server_side=True) data = yield tb.read(len(A_DATA)) self.assertEqual(data, A_DATA) yield tb.write(b'OK') data = yield tb.read(len(B_DATA)) self.assertEqual(data, B_DATA) yield tb.write(b'SPAM') yield tb.close()
def prog(): try: yield tb.starttls(client_sslctx) yield tb.connect(addr) yield tb.write(A_DATA) data = yield tb.read(2) self.assertEqual(data, b'OK') yield tb.write(B_DATA) data = yield tb.read(4) self.assertEqual(data, b'SPAM') yield tb.close() except Exception as ex: self.loop.call_soon_threadsafe(fut.set_exception, ex) else: self.loop.call_soon_threadsafe(fut.set_result, None)
def srv_gen(): yield tb.write(b'helo') data = yield tb.read(4 * _SIZE) self.assertEqual(data, b'ehlo' * _SIZE) yield tb.write(b'O') yield tb.write(b'K')