def run(self, testcase): for n, s in self.data: self.buf.truncate(0) self.buf.write(s) self.buf.seek(0) testcase.assertEqual(self.decoder.readElement(), n) if self.buf.remaining() != 0: from pyamf.util import hexdump print hexdump(self.buf.getvalue()) # make sure that the entire buffer was consumed testcase.assertEqual(self.buf.remaining(), 0)
def dataReceived(self, recvd): logger.info("client %s -> server %s (%d bytes)\n%s" % ( self.clientName, self.serverName, len(recvd), hexdump(recvd))) if hasattr(self, "dest"): self.dest.write(recvd) else: logger.debug("caching data until remote connection is open") self.clientFactory.writeCache.append(recvd)
def write(self, buf): logger.info("client %s <= server %s (%d bytes)\n%s" % ( self.clientName, self.serverName, len(buf), hexdump(buf))) self.transport.write(buf)