class 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;

        // Retrieves the next message asynchronously.
        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();
    }

    public  TextTelephony();

}