Search in sources :

Example 26 with TestSubscription

use of io.servicetalk.concurrent.api.TestSubscription in project servicetalk by apple.

the class FlushTest method testCancel.

@Test
void testCancel() {
    final TestSubscription subscription = new TestSubscription();
    source.onSubscribe(subscription);
    subscriber.awaitSubscription().cancel();
    verify(channel).eventLoop();
    verifyNoMoreInteractions(channel);
    assertThat(subscriber.pollOnNext(10, MILLISECONDS), is(nullValue()));
    assertThat(subscriber.pollTerminal(10, MILLISECONDS), is(nullValue()));
    assertTrue(subscription.isCancelled());
    strategy.verifyWriteCancelled();
}
Also used : TestSubscription(io.servicetalk.concurrent.api.TestSubscription) Test(org.junit.jupiter.api.Test)

Aggregations

TestSubscription (io.servicetalk.concurrent.api.TestSubscription)26 Test (org.junit.jupiter.api.Test)19 TestPublisher (io.servicetalk.concurrent.api.TestPublisher)7 StreamingHttpResponse (io.servicetalk.http.api.StreamingHttpResponse)7 Buffer (io.servicetalk.buffer.api.Buffer)4 Subscription (io.servicetalk.concurrent.PublisherSource.Subscription)4 AsyncCloseables.newCompositeCloseable (io.servicetalk.concurrent.api.AsyncCloseables.newCompositeCloseable)4 ScalarValueSubscription (io.servicetalk.concurrent.internal.ScalarValueSubscription)4 HttpExecutionStrategies.defaultStrategy (io.servicetalk.http.api.HttpExecutionStrategies.defaultStrategy)4 StreamingHttpClient (io.servicetalk.http.api.StreamingHttpClient)4 ServerContext (io.servicetalk.transport.api.ServerContext)4 AddressUtils.localAddress (io.servicetalk.transport.netty.internal.AddressUtils.localAddress)4 AddressUtils.serverHostAndPort (io.servicetalk.transport.netty.internal.AddressUtils.serverHostAndPort)4 ClientGroup (io.servicetalk.client.api.ClientGroup)3 ServiceDiscoverer (io.servicetalk.client.api.ServiceDiscoverer)3 AVAILABLE (io.servicetalk.client.api.ServiceDiscovererEvent.Status.AVAILABLE)3 DefaultPartitionAttributesBuilder (io.servicetalk.client.api.internal.partition.DefaultPartitionAttributesBuilder)3 PartitionAttributes (io.servicetalk.client.api.partition.PartitionAttributes)3 PartitionAttributesBuilder (io.servicetalk.client.api.partition.PartitionAttributesBuilder)3 PartitionedServiceDiscovererEvent (io.servicetalk.client.api.partition.PartitionedServiceDiscovererEvent)3