@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(); } }
@Override public void releaseResources() { this.content.clear(); super.releaseResources(); }
StringAsyncEntityProducer extends AbstractCharAsyncEntityProducer { @Override public void releaseResources() { this.content.clear(); super.releaseResources(); } }
StringAsyncEntityProducer extends AbstractCharAsyncEntityProducer { @Override public void releaseResources() { this.content.clear(); super.releaseResources(); } StringAsyncEntityProducer(
            final CharSequence content,
            final int bufferSize,
            final int fragmentSizeHint,
            final ContentType contentType);  StringAsyncEntityProducer(final CharSequence content, final int bufferSize, final ContentType contentType);  StringAsyncEntityProducer(final CharSequence content, final ContentType contentType);  StringAsyncEntityProducer(final CharSequence content); }
StringAsyncEntityProducer extends AbstractCharAsyncEntityProducer { @Override public void releaseResources() { this.content.clear(); super.releaseResources(); } StringAsyncEntityProducer(
            final CharSequence content,
            final int bufferSize,
            final int fragmentSizeHint,
            final ContentType contentType);  StringAsyncEntityProducer(final CharSequence content, final int bufferSize, final ContentType contentType);  StringAsyncEntityProducer(final CharSequence content, final ContentType contentType);  StringAsyncEntityProducer(final CharSequence content); @Override boolean isRepeatable(); @Override void failed(final Exception cause); Exception getException(); @Override void releaseResources(); }
StringAsyncEntityProducer extends AbstractCharAsyncEntityProducer { @Override public void releaseResources() { this.content.clear(); super.releaseResources(); } StringAsyncEntityProducer(
            final CharSequence content,
            final int bufferSize,
            final int fragmentSizeHint,
            final ContentType contentType);  StringAsyncEntityProducer(final CharSequence content, final int bufferSize, final ContentType contentType);  StringAsyncEntityProducer(final CharSequence content, final ContentType contentType);  StringAsyncEntityProducer(final CharSequence content); @Override boolean isRepeatable(); @Override void failed(final Exception cause); Exception getException(); @Override void releaseResources();  }