@Test
public void requestToMultitimeStreamCannotBeDoneAfterTheTimeoutOfTheStreamHasExipred() throws Exception {

    final int streamTimeout = 1;
    AudioStream audioStream = getByteArrayAudioStream(testByteArray, AudioFormat.CONTAINER_NONE,
            AudioFormat.CODEC_MP3);
    final long beg = System.currentTimeMillis();
    String url = serveStream(audioStream, streamTimeout);
    Request request = getHttpRequest(url);
    ContentResponse response = request.send();
    final long end = System.currentTimeMillis();
    if (response.getStatus() == HttpStatus.NOT_FOUND_404) {
        assertThat("Response status 404 is only allowed if streamTimeout is exceeded.",
                TimeUnit.MILLISECONDS.toSeconds(end - beg), greaterThan((long) streamTimeout));
    } else {
        assertThat("The response status was not as expected", response.getStatus(), is(HttpStatus.OK_200));
        assertThat("The response content was not as expected", response.getContent(), is(testByteArray));
        assertThat("The response media type was not as expected", response.getMediaType(),
                is(MEDIA_TYPE_AUDIO_MPEG));
        assertThat("The audio stream was not added to the multitime streams",
                audioServlet.getMultiTimeStreams().containsValue(audioStream), is(true));
    }
    waitForAssert(() -> {
        try {
            request.send();
        } catch (Exception e) {
            throw new IllegalStateException(e);
        }
        assertThat("The audio stream was not removed from multitime streams",
                audioServlet.getMultiTimeStreams().containsValue(audioStream), is(false));
    });
    response = request.send();
    assertThat("The response status was not as expected", response.getStatus(), is(HttpStatus.NOT_FOUND_404));
}