'Waits for and deserializes messages. Returns a single message; the
oldest not yet processed.'

def wait(self):

    while (not self._message_queue):
        if self.closed:
            return None
        new_data = self.protocol.read()
        if (not new_data):
            return None
        self._message_queue.append(new_data)
    return self._message_queue.popleft()
