'L{StreamServerEndpointService.startService} should raise synchronously
if the L{Deferred} returned by its wrapped
L{IStreamServerEndpoint.listen} has already fired with an errback and
the L{StreamServerEndpointService}\'s C{_raiseSynchronously} flag has
been set.  This feature is necessary to preserve compatibility with old
behavior of L{twisted.internet.strports.service}, which is to return a
service which synchronously raises an exception from C{startService}
(so that, among other things, twistd will not start running).  However,
since L{IStreamServerEndpoint.listen} may fail asynchronously, it is a
bad idea to rely on this behavior.
@param thunk: If specified, a callable to execute in place of
C{startService}.'

def test_synchronousRaiseRaisesSynchronously(self, thunk=None):

    self.fakeServer.failImmediately = ZeroDivisionError()
    self.svc._raiseSynchronously = True
    self.assertRaises(ZeroDivisionError, (thunk or self.svc.startService))
