Example #1
0
def test_stream_source_to_textfile_explicit(lsource):
    agent = cl1.new_default_agent()
    with open("mydata.fmf", "w") as handle:
        # a cl1.FileLikeDestination simply writes all received packets
        # to a given file like object (handle)
        dest = cl1.FileLikeDestination(handle)
        agent.transmit(lsource, dest)
Example #2
0
def test_stream_source_to_textfile_explicit(lsource):
    agent = cl1.new_default_agent()
    with open('mydata.fmf', 'w') as handle:
        # a cl1.FileLikeDestination simply writes all received packets
        # to a given file like object (handle)
        dest = cl1.FileLikeDestination(handle)
        agent.transmit(lsource, dest)
Example #3
0
def prepare_stream(protocol):
    agent = cl1.new_default_agent()
    _prtcl = protocol

    class NoOpDestination(streamlib.Destination):
        protocol = _prtcl
        receive_packet = lambda self, packet, context: None

    stream = agent.new_stream(NoOpDestination())
    stream.set_protocol(protocol)
    return stream
Example #4
0
def prepare_stream(protocol):
    agent = cl1.new_default_agent()
    _prtcl = protocol

    class NoOpDestination(streamlib.Destination):
        protocol = _prtcl
        receive_packet = lambda self, packet, context: None

    stream = agent.new_stream(NoOpDestination())
    stream.set_protocol(protocol)
    return stream
Example #5
0
def agent():
    return cl1.new_default_agent()
Example #6
0
def test_stream_source_to_textfile_explicit_alternative(lsource):
    agent = cl1.new_default_agent()
    with open("mydata.fmf", "w") as handle:
        dest = cl1.FileLikeDestination(handle)
        stream = agent.new_stream(dest)
        lsource.inject_into(stream)
Example #7
0
def agent():
    return cl1.new_default_agent()
Example #8
0
def test_stream_source_to_textfile_explicit_alternative(lsource):
    agent = cl1.new_default_agent()
    with open('mydata.fmf', 'w') as handle:
        dest = cl1.FileLikeDestination(handle)
        stream = agent.new_stream(dest)
        lsource.inject_into(stream)