def test_connectionLost(self):
    '\n        If there is an error issuing the request to the remote publisher, an\n        error response is returned.\n        '
    self.f1 = serverFactory = PBServerFactory(pb.Root())
    self.port1 = serverPort = reactor.listenTCP(0, serverFactory)
    self.sub = subscription = distrib.ResourceSubscription('127.0.0.1', serverPort.getHost().port)
    request = DummyRequest([b''])
    d = _render(subscription, request)

    def cbRendered(ignored):
        self.assertEqual(request.responseCode, 500)
        errors = self.flushLoggedErrors(pb.NoSuchMethod)
        self.assertEqual(len(errors), 1)
        expected = [b'', b'<html>', b'  <head><title>500 - Server Connection Lost</title></head>', b'  <body>', b'    <h1>Server Connection Lost</h1>', b'    <p>Connection to distributed server lost:<pre>[Failure instance: Traceback from remote host -- twisted.spread.flavors.NoSuchMethod: No such method: remote_request', b']</pre></p>', b'  </body>', b'</html>', b'']
        self.assertEqual([b'\n'.join(expected)], request.written)
    d.addCallback(cbRendered)
    return d
If there is an error issuing the request to the remote publisher, an
error response is returned.
def test_connectionLost(self):
    '\n        If there is an error issuing the request to the remote publisher, an\n        error response is returned.\n        '
    self.f1 = serverFactory = PBServerFactory(pb.Root())
    self.port1 = serverPort = reactor.listenTCP(0, serverFactory)
    self.sub = subscription = distrib.ResourceSubscription('127.0.0.1', serverPort.getHost().port)
    request = DummyRequest([b])
    d = _render(subscription, request)

    def cbRendered(ignored):
        self.assertEqual(request.responseCode, 500)
        errors = self.flushLoggedErrors(pb.NoSuchMethod)
        self.assertEqual(len(errors), 1)
        expected = [b, b'<html>', b'  <head><title>500 - Server Connection Lost</title></head>', b'  <body>', b'    <h1>Server Connection Lost</h1>', b'    <p>Connection to distributed server lost:<pre>[Failure instance: Traceback from remote host -- twisted.spread.flavors.NoSuchMethod: No such method: remote_request', b']</pre></p>', b'  </body>', b'</html>', b]
        self.assertEqual([b'\n'.join(expected)], request.written)
    d.addCallback(cbRendered)
    return d