'Issue a search with given query and verify that the returned messages
match the given expected messages.
@param queryTerms: A string giving the search query.
@param expectedMessages: A list of the message sequence numbers
expected as the result of the search.
@return: A L{Deferred} which fires when the test is complete.'

def _messageSetSearchTest(self, queryTerms, expectedMessages):

    def search():
        return self.client.search(queryTerms)
    d = self.connected.addCallback(strip(search))
    def searched(results):
        self.assertEqual(results, expectedMessages)
    d.addCallback(searched)
    d.addCallback(self._cbStopClient)
    d.addErrback(self._ebGeneral)
    self.loopback()
    return d
