'L{IMAP4Client.startTLS} triggers TLS negotiation and returns a
L{Deferred} which fires after the client\'s transport is using
encryption.'

def test_startTLS(self):

    success = []
    self.connected.addCallback((lambda _: self.client.startTLS()))
    def checkSecure(ignored):
        self.assertTrue(interfaces.ISSLTransport.providedBy(self.client.transport))
    self.connected.addCallback(checkSecure)
    self.connected.addCallback(self._cbStopClient)
    self.connected.addCallback(success.append)
    self.connected.addErrback(self._ebGeneral)
    d = self.loopback()
    d.addCallback((lambda x: self.assertTrue(success)))
    return defer.gatherResults([d, self.connected])
