Add start and stop for RSocket client and tester

Closes gh-378
This commit is contained in:
rstoyanchev
2022-05-06 10:55:30 +01:00
parent 5b59e51bab
commit 8549060d19
6 changed files with 72 additions and 12 deletions

View File

@@ -21,6 +21,7 @@ import java.util.List;
import java.util.function.Consumer;
import io.rsocket.transport.ClientTransport;
import reactor.core.publisher.Mono;
import org.springframework.core.codec.Decoder;
import org.springframework.core.codec.Encoder;
@@ -141,6 +142,16 @@ public class DefaultRSocketGraphQlTesterBuilder
this.builderInitializer = builderInitializer;
}
@Override
public Mono<Void> start() {
return this.rsocketGraphQlClient.start();
}
@Override
public Mono<Void> stop() {
return this.rsocketGraphQlClient.stop();
}
@Override
public RSocketGraphQlTester.Builder<?> mutate() {
DefaultRSocketGraphQlTesterBuilder builder = new DefaultRSocketGraphQlTesterBuilder(this.rsocketGraphQlClient);

View File

@@ -21,7 +21,9 @@ import java.net.URI;
import java.util.function.Consumer;
import io.rsocket.transport.ClientTransport;
import reactor.core.publisher.Mono;
import org.springframework.graphql.client.RSocketGraphQlClient;
import org.springframework.messaging.rsocket.RSocketRequester;
import org.springframework.util.MimeType;
@@ -33,6 +35,19 @@ import org.springframework.util.MimeType;
*/
public interface RSocketGraphQlTester extends GraphQlTester {
/**
* Start the RSocket session.
* @return {@code Mono} that completes when the underlying session is started
*/
Mono<Void> start();
/**
* Stop the RSocket session.
* @return {@code Mono} that completes when the underlying session is closed
* <p>Note that currently this method not differed and does not wait,
* see {@link RSocketGraphQlClient#stop()}
*/
Mono<Void> stop();
@Override
RSocketGraphQlTester.Builder<?> mutate();