(self)
| 2087 | self.cleanup() |
| 2088 | |
| 2089 | def test(self): |
| 2090 | ssn = self.c1.session() |
| 2091 | snd = ssn.sender("sender") |
| 2092 | self.c1.open() |
| 2093 | ssn.open() |
| 2094 | snd.open() |
| 2095 | |
| 2096 | for i in range(10): |
| 2097 | t = "delivery-%s" % i |
| 2098 | d = snd.delivery(t) |
| 2099 | snd.send(t.encode('ascii')) |
| 2100 | d.settle() |
| 2101 | |
| 2102 | snd.close() |
| 2103 | ssn.close() |
| 2104 | self.c1.close() |
| 2105 | |
| 2106 | self.pump() |
| 2107 | |
| 2108 | state = self.c2.state |
| 2109 | assert state == (Endpoint.LOCAL_UNINIT | Endpoint.REMOTE_ACTIVE), "%x" % state |
| 2110 | ssn2 = self.c2.session_head(Endpoint.LOCAL_UNINIT) |
| 2111 | assert ssn2 |
| 2112 | state == ssn2.state |
| 2113 | assert state == (Endpoint.LOCAL_UNINIT | Endpoint.REMOTE_ACTIVE), "%x" % state |
| 2114 | rcv = self.c2.link_head(Endpoint.LOCAL_UNINIT) |
| 2115 | assert rcv |
| 2116 | state = rcv.state |
| 2117 | assert state == (Endpoint.LOCAL_UNINIT | Endpoint.REMOTE_ACTIVE), "%x" % state |
| 2118 | |
| 2119 | self.c2.open() |
| 2120 | ssn2.open() |
| 2121 | rcv.open() |
| 2122 | rcv.flow(10) |
| 2123 | assert rcv.queued == 0, rcv.queued |
| 2124 | |
| 2125 | self.pump() |
| 2126 | |
| 2127 | assert rcv.queued == 10, rcv.queued |
| 2128 | state = rcv.state |
| 2129 | assert state == (Endpoint.LOCAL_ACTIVE | Endpoint.REMOTE_CLOSED), "%x" % state |
| 2130 | state = ssn2.state |
| 2131 | assert state == (Endpoint.LOCAL_ACTIVE | Endpoint.REMOTE_CLOSED), "%x" % state |
| 2132 | state = self.c2.state |
| 2133 | assert state == (Endpoint.LOCAL_ACTIVE | Endpoint.REMOTE_CLOSED), "%x" % state |
| 2134 | |
| 2135 | for i in range(rcv.queued): |
| 2136 | d = rcv.current |
| 2137 | assert d |
| 2138 | assert d.tag == "delivery-%s" % i |
| 2139 | d.settle() |
| 2140 | |
| 2141 | assert rcv.queued == 0, rcv.queued |
| 2142 | |
| 2143 | |
| 2144 | class ServerTest(Test): |
no test coverage detected