@Test
public void testTextContentRepeatable() throws Exception {

    final AsyncEntityProducer producer = new StringAsyncEntityProducer(
            "abc", ContentType.TEXT_PLAIN);
    Assert.assertEquals(-1, producer.getContentLength());
    Assert.assertEquals(ContentType.TEXT_PLAIN.toString(), producer.getContentType());
    Assert.assertEquals(null, producer.getContentEncoding());
    for (int i = 0; i < 3; i++) {
        final WritableByteChannelMock byteChannel = new WritableByteChannelMock(1024);
        final DataStreamChannel streamChannel = new BasicDataStreamChannel(byteChannel);
        producer.produce(streamChannel);
        Assert.assertFalse(byteChannel.isOpen());
        Assert.assertEquals("abc", byteChannel.dump(StandardCharsets.US_ASCII));
        producer.releaseResources();
    }
}