TextTelephony implements Telephony { @Override public void play(final SynthesizedOutput output, final CallControlProperties props) throws NoresourceError, IOException { if (sentHungup) { throw new NoresourceError("connection disconnected"); } if (!(output instanceof TextSynthesizedOutput)) { throw new IOException("output does not deliver text!"); } textOutput = (TextSynthesizedOutput) output; final Thread thread = new Thread() { @Override public void run() { final SpeakableText speakable = textOutput.getNextText(); synchronized (pendingMessages) { firePlayStarted(); if (sender != null) { sender.sendData(speakable); } } } }; thread.start(); } TextTelephony(); @Override void play(final SynthesizedOutput output,
            final CallControlProperties props); @Override void stopPlay(); @Override void record(final SpokenInput input,
            final CallControlProperties props); @Override AudioFormat getRecordingAudioFormat(); @Override void startRecording(final SpokenInput input,
            final OutputStream stream, final CallControlProperties props); @Override void stopRecording(); @Override void transfer(final String dest); @Override void hangup(); @Override void activate(); @Override void close(); @Override String getType(); @Override boolean isBusy(); @Override boolean isActive(); @Override void open(); @Override void passivate(); @Override void connect(final ConnectionInformation info); @Override void disconnect(final ConnectionInformation client); @Override void addListener(final TelephonyListener callListener); @Override void removeListener(final TelephonyListener callListener);  }
@Test(timeout = 5000) public void testPlay() throws Exception, JVoiceXMLEvent { final TextSynthesizedOutput textOutput = new TextSynthesizedOutput(); final String prompt = "testPlay"; final SpeakableSsmlText speakable = new SpeakableSsmlText(prompt, Locale.US); textOutput.queueSpeakable(speakable, sessionId, null); telephony.play(textOutput, null); synchronized (lock) { lock.wait(MAX_WAIT); } assertEquals(speakable.getDocument(), receivedDocument); }