'Incoming emails to a SMTP server with L{twisted.mail.mail.BounceDomain}
are rejected.'

def test_rejected(self):

    service = mail.mail.MailService()
    domain = mail.mail.BounceDomain()
    service.addDomain('foo.com', domain)
    factory = mail.protocols.SMTPFactory(service)
    protocol = factory.buildProtocol(None)
    deliverer = mail.protocols.SMTPDomainDelivery(service, None, None)
    protocol.delivery = deliverer
    transport = StringTransport()
    protocol.makeConnection(transport)
    protocol.lineReceived('HELO    baz.net')
    protocol.lineReceived('MAIL    FROM:<a@baz.net>')
    protocol.lineReceived('RCPT    TO:<any@foo.com>')
    protocol.lineReceived('QUIT')
    self.assertTrue(transport.disconnecting)
    protocol.connectionLost(None)
    self.assertEqual(transport.value().strip().split('\r\n')[(-2)], '550    Cannot    receive    for    specified    address')
