~certify-web-dev/twisted/certify-trunk

« back to all changes in this revision

Viewing changes to twisted/test/proto_helpers.py

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2007-01-17 14:52:35 UTC
  • mfrom: (1.1.5 upstream) (2.1.2 etch)
  • Revision ID: james.westby@ubuntu.com-20070117145235-btmig6qfmqfen0om
Tags: 2.5.0-0ubuntu1
New upstream version, compatible with python2.5.

Show diffs side-by-side

added added

removed removed

Lines of Context:
44
44
class StringTransport:
45
45
    disconnecting = 0
46
46
 
47
 
    def __init__(self):
 
47
    hostAddr = None
 
48
    peerAddr = None
 
49
 
 
50
    def __init__(self, hostAddress=None, peerAddress=None):
48
51
        self.clear()
 
52
        if hostAddress is not None:
 
53
            self.hostAddr = hostAddress
 
54
        if peerAddress is not None:
 
55
            self.peerAddr = peerAddress
49
56
 
50
57
    def clear(self):
51
58
        self.io = StringIO()
63
70
        pass
64
71
 
65
72
    def getPeer(self):
66
 
        return ('StringIO', repr(self.io))
 
73
        if self.peerAddr is None:
 
74
            return ('StringIO', repr(self.io))
 
75
        return self.peerAddr
67
76
 
68
77
    def getHost(self):
69
 
        return ('StringIO', repr(self.io))
 
78
        if self.hostAddr is None:
 
79
            return ('StringIO', repr(self.io))
 
80
        return self.hostAddr
70
81
 
71
82
 
72
83
class StringTransportWithDisconnection(StringTransport):