@Test
public void testNextMessage() throws Exception, JVoiceXMLEvent {

    final TextServer server = new TextServer(9494);
    final OutputMessageBuffer buffer = new OutputMessageBuffer(server);
    final SsmlDocument document = new SsmlDocument();
    final Speak speak = document.getSpeak();
    speak.addText("hello world");
    final Runnable runnable = new Runnable() {
        @Override
        public void run() {
            buffer.outputSsml(null, document);
        }
    };
    final Thread thread = new Thread(runnable);
    thread.start();
    final SsmlDocument next = buffer.nextMessage();
    Assert.assertEquals(document, next);
}