'Helper function to connect a modified protocol to the test protocol
and test for disconnection.'

def connectModifiedProtocol(self, protoModification, kind=None):

    if (kind is None):
        kind = transport.DISCONNECT_KEY_EXCHANGE_FAILED
    proto2 = self.klass()
    protoModification(proto2)
    proto2.makeConnection(proto_helpers.StringTransport())
    self.proto.dataReceived(proto2.transport.value())
    if kind:
        self.checkDisconnected(kind)
    return proto2
