|
34 | 34 | import io.rsocket.test.util.TestSubscriber;
|
35 | 35 | import io.rsocket.util.DefaultPayload;
|
36 | 36 | import io.rsocket.util.EmptyPayload;
|
| 37 | +import java.time.Duration; |
37 | 38 | import java.util.ArrayList;
|
38 | 39 | import java.util.concurrent.atomic.AtomicReference;
|
39 | 40 | import org.assertj.core.api.Assertions;
|
@@ -120,6 +121,32 @@ public Mono<Payload> requestResponse(Payload payload) {
|
120 | 121 | rule.assertServerError("CustomRSocketException (0x501): Deliberate Custom exception.");
|
121 | 122 | }
|
122 | 123 |
|
| 124 | + @Test(timeout = 2000) |
| 125 | + public void testRequestPropagatesCorrectlyForRequestChannel() { |
| 126 | + rule.setRequestAcceptor( |
| 127 | + new AbstractRSocket() { |
| 128 | + @Override |
| 129 | + public Flux<Payload> requestChannel(Publisher<Payload> payloads) { |
| 130 | + return Flux.from(payloads) |
| 131 | + // specifically limits request to 3 in order to prevent 256 request from limitRate |
| 132 | + // hidden on the responder side |
| 133 | + .limitRequest(3); |
| 134 | + } |
| 135 | + }); |
| 136 | + |
| 137 | + Flux.range(0, 3) |
| 138 | + .map(i -> DefaultPayload.create("" + i)) |
| 139 | + .as(rule.crs::requestChannel) |
| 140 | + .as(publisher -> StepVerifier.create(publisher, 3)) |
| 141 | + .expectSubscription() |
| 142 | + .expectNextCount(3) |
| 143 | + .expectComplete() |
| 144 | + .verify(Duration.ofMillis(5000)); |
| 145 | + |
| 146 | + rule.assertNoClientErrors(); |
| 147 | + rule.assertNoServerErrors(); |
| 148 | + } |
| 149 | + |
123 | 150 | @Test(timeout = 2000)
|
124 | 151 | public void testStream() throws Exception {
|
125 | 152 | Flux<Payload> responses = rule.crs.requestStream(DefaultPayload.create("Payload In"));
|
|
0 commit comments