'Reject elements that are not handshakes'

def test_onElementNotHandshake(self):

    handshakes = []
    streamErrors = []
    xs = self.xmlstream
    xs.authenticator.onHandshake = handshakes.append
    xs.sendStreamError = streamErrors.append
    element = domish.Element(('jabber:component:accept', 'message'))
    xs.authenticator.onElement(element)
    self.assertFalse(handshakes)
    self.assertEqual('not-authorized', streamErrors[(-1)].condition)
