Java Code Examples for reactor.core.publisher.Flux#never()

The following examples show how to use reactor.core.publisher.Flux#never() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
private Flux<Object> pastEndTime(TopicContext topicContext) {
    if (topicContext.getFilter().getEndTime() == null) {
        return Flux.never();
    }

    return Flux.empty().repeatWhen(Repeat.create(r -> !topicContext.isComplete(), Long.MAX_VALUE)
            .fixedBackoff(grpcProperties.getEndTimeInterval()));
}
 
Example 2
@Test
public void subscribedTwiceDetectsSpecialSubscription() {
	Flux<String> flux = Flux.never();

	DefaultVerifySubscriber<String> s =
			new DefaultStepVerifierBuilder<String>(StepVerifierOptions.create().initialRequest(Long.MAX_VALUE), null)
					.expectErrorMessage("expected")
			.toSubscriber();

	flux.subscribe(s);
	Operators.reportThrowInSubscribe(s, new RuntimeException("expected"));

	s.verify(Duration.ofSeconds(1));
}
 
Example 3
Source Project: reactor-core   File: StepVerifierTests.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void verifyNeverWithExpectTimeout() {
	Flux<String> flux = Flux.never();

	StepVerifier.create(flux)
	            .expectTimeout(Duration.ofMillis(500))
	            .verify();
}
 
Example 4
@Override
public Flux<Executable> executionPlans() {
    return Flux.never();
}
 
Example 5
@Override
public Flux<TaskRelocationEvent> events(TaskRelocationQuery query) {
    return Flux.never();
}
 
Example 6
@Override
public Flux<PodEvent> events() {
    return Flux.never();
}
 
Example 7
Source Project: reactor-netty   File: TcpServerTests.java    License: Apache License 2.0 4 votes vote down vote up
@Test
public void exposesNettyPipelineConfiguration() throws InterruptedException {
	final int port = SocketUtils.findAvailableTcpPort();
	final CountDownLatch latch = new CountDownLatch(2);

	final TcpClient client = TcpClient.create().port(port);

	BiFunction<? super NettyInbound, ? super NettyOutbound, ? extends Publisher<Void>>
			serverHandler = (in, out) -> {
		in.receive()
		  .asString()
		  .subscribe(data -> {
		      log.info("data " + data + " on " + in);
		      latch.countDown();
		  });
		return Flux.never();
	};

	TcpServer server = TcpServer.create()
	                            .doOnConnection(c -> c.addHandlerLast("codec",
	                                                                  new LineBasedFrameDecoder(8 * 1024)))
	                            .port(port);

	DisposableServer connected = server.handle(serverHandler)
	                                   .wiretap(true)
	                                   .bindNow();

	assertNotNull(connected);

	Connection clientContext =
			client.handle((in, out) -> out.sendString(Flux.just("Hello World!\n", "Hello 11!\n")))
			      .wiretap(true)
			      .connectNow();

	assertNotNull(clientContext);

	assertTrue("Latch was counted down", latch.await(10, TimeUnit.SECONDS));

	connected.disposeNow();
	clientContext.disposeNow();
}