Exemple #1
0
    def server():
        yield tb.starttls(sslctx, server_side=True)

        data = yield tb.read(len(A_DATA))
        assert data == A_DATA
        yield tb.write(b'OK')

        data = yield tb.read(len(B_DATA))
        assert data == B_DATA
        yield tb.write(b'SPAM')

        yield tb.close()
Exemple #2
0
        def prog():
            try:
                yield tb.starttls(client_sslctx)
                yield tb.connect(addr)
                yield tb.write(A_DATA)

                data = yield tb.read(2)
                assert data == b'OK'

                yield tb.write(B_DATA)
                data = yield tb.read(4)
                assert data == b'SPAM'

                yield tb.close()

            except Exception as ex:
                loop.call_soon_threadsafe(fut.set_exception, ex)
            else:
                loop.call_soon_threadsafe(fut.set_result, None)
Exemple #3
0
 def server():
     data = yield tb.read(4)
     assert data == b'AAAA'
     yield tb.close()