Search in sources :

Example 1 with CharSequenceEncoder

use of cn.taketoday.core.codec.CharSequenceEncoder in project today-infrastructure by TAKETODAY.

the class CancelWithoutDemandCodecTests method cancelWithEncoderHttpMessageWriterAndSingleValue.

// gh-22107
@Test
public void cancelWithEncoderHttpMessageWriterAndSingleValue() {
    CharSequenceEncoder encoder = CharSequenceEncoder.allMimeTypes();
    HttpMessageWriter<CharSequence> writer = new EncoderHttpMessageWriter<>(encoder);
    CancellingOutputMessage outputMessage = new CancellingOutputMessage(this.bufferFactory);
    writer.write(Mono.just("foo"), ResolvableType.fromType(String.class), MediaType.TEXT_PLAIN, outputMessage, Collections.emptyMap()).block(Duration.ofSeconds(5));
}
Also used : CharSequenceEncoder(cn.taketoday.core.codec.CharSequenceEncoder) Test(org.junit.jupiter.api.Test)

Example 2 with CharSequenceEncoder

use of cn.taketoday.core.codec.CharSequenceEncoder in project today-framework by TAKETODAY.

the class CancelWithoutDemandCodecTests method cancelWithEncoderHttpMessageWriterAndSingleValue.

// gh-22107
@Test
public void cancelWithEncoderHttpMessageWriterAndSingleValue() {
    CharSequenceEncoder encoder = CharSequenceEncoder.allMimeTypes();
    HttpMessageWriter<CharSequence> writer = new EncoderHttpMessageWriter<>(encoder);
    CancellingOutputMessage outputMessage = new CancellingOutputMessage(this.bufferFactory);
    writer.write(Mono.just("foo"), ResolvableType.fromType(String.class), MediaType.TEXT_PLAIN, outputMessage, Collections.emptyMap()).block(Duration.ofSeconds(5));
}
Also used : CharSequenceEncoder(cn.taketoday.core.codec.CharSequenceEncoder) Test(org.junit.jupiter.api.Test)

Aggregations

CharSequenceEncoder (cn.taketoday.core.codec.CharSequenceEncoder)2 Test (org.junit.jupiter.api.Test)2