class documentation

class MockProtocol(protocol.Protocol):

View In Hierarchy

A sample Protocol which stores the data passed to it.

Method connectionLost Close the protocol and store the reason.
Method connectionMade Set up the instance variables. If we have any packetData, send it along.
Method dataReceived Store the received data and write it back with a tilde appended. The tilde is appended so that the tests can verify that we processed the data.
Instance Variable data a bytes of the data passed to us.
Instance Variable open True if the channel is open.
Instance Variable packetData a bytes of data to be sent when the connection is made.
Instance Variable reason if not None, the reason the protocol was closed.

Inherited from Protocol:

Method logPrefix Return a prefix matching the class name, to identify log messages related to this protocol instance.
Class Variable factory Undocumented

Inherited from BaseProtocol (via Protocol):

Method makeConnection Make a connection to a transport and a server.
Instance Variable connected Undocumented
Instance Variable transport Undocumented
def connectionLost(self, reason):

Close the protocol and store the reason.

def connectionMade(self):

Set up the instance variables. If we have any packetData, send it along.

def dataReceived(self, data):

Store the received data and write it back with a tilde appended. The tilde is appended so that the tests can verify that we processed the data.

data: bytes =

a bytes of the data passed to us.

open: bool =

True if the channel is open.

packetData: bytes =

a bytes of data to be sent when the connection is made.

reason =

if not None, the reason the protocol was closed.