JVoiceXmlDocumentServer implements DocumentServer { @Override public AudioInputStream getAudioInputStream(final String sessionId, final URI uri) throws BadFetchError { if (LOGGER.isDebugEnabled()) { LOGGER.debug("retrieving audio input stream '" + uri + "'"); } final SchemeStrategy strategy = getSchemeStrategy(uri); final FetchAttributes attrs = mergeFetchAttributes(null); final long timeout = attrs.getFetchTimeout(); try { final InputStream input = strategy.getInputStream(sessionId, uri, RequestMethod.GET, timeout, null); final BufferedInputStream buf = new BufferedInputStream(input); return AudioSystem.getAudioInputStream(buf); } catch (javax.sound.sampled.UnsupportedAudioFileException e) { throw new BadFetchError(e.getMessage(), e); } catch (java.io.IOException e) { throw new BadFetchError(e.getMessage(), e); } catch (UnsupportedElementError e) { throw new BadFetchError(e.getMessage(), e); } } JVoiceXmlDocumentServer(); void setDocumentStorage(final DocumentStorage documentStorage); @Override void start(); void setSchemeStrategies(final List<SchemeStrategy> schemeStrategies); void setFetchAttributes(final FetchAttributes attrs); @Override VoiceXmlDocument getDocument(final String sessionId,
            final DocumentDescriptor descriptor); void addSchemeStrategy(final SchemeStrategy strategy); @Override URI resolveBuiltinUri(final URI uri); @Override URI addGrammarDocument(final String sessionId,
            final GrammarDocument document); @Override GrammarDocument getGrammarDocument(final String sessionId,
            final URI uri, final FetchAttributes attrs); @Override AudioInputStream getAudioInputStream(final String sessionId,
            final URI uri); @Override Object getObject(final String sessionId,
            final DocumentDescriptor descriptor, final String type); @Override URI storeAudio(final AudioInputStream in); @Override void sessionClosed(final String sessionId); @Override void stop();  }
@Test public void testGetAudioInputStream() throws Exception, JVoiceXMLEvent { final URL file = this.getClass().getResource("/test.wav"); final Session session = Mockito.mock(Session.class); Mockito.when(session.getSessionId()).thenReturn( UUID.randomUUID().toString()); final String sessionId = session.getSessionId(); final AudioInputStream in = server.getAudioInputStream(sessionId, file.toURI()); Assert.assertNotNull(in); }