'Initiate the protocol instance. Since we are building a simple IMAP
client, we don\'t bother checking what capabilities the server has. We
just add all the authenticators twisted.mail has.  Note: Gmail no
longer uses any of the methods below, it\'s been using XOAUTH since
2010.'

def buildProtocol(self, addr):

    assert (not self.usedUp)
    self.usedUp = True
    p = self.protocol()
    p.factory = self
    p.greetDeferred = self.onConn
    p.registerAuthenticator(imap4.PLAINAuthenticator(self.username))
    p.registerAuthenticator(imap4.LOGINAuthenticator(self.username))
    p.registerAuthenticator(imap4.CramMD5ClientAuthenticator(self.username))
    return p
