File tree Expand file tree Collapse file tree 4 files changed +13
-7
lines changed
main/java/io/rsocket/core
test/java/io/rsocket/core
rsocket-examples/src/test/java/io/rsocket/integration Expand file tree Collapse file tree 4 files changed +13
-7
lines changed Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright 2015-2018 the original author or authors.
2
+ * Copyright 2015-2020 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
@@ -348,7 +348,7 @@ private Flux<Payload> handleRequestStream(final Payload payload) {
348
348
}
349
349
350
350
final UnboundedProcessor <ByteBuf > sendProcessor = this .sendProcessor ;
351
- final UnicastProcessor <Payload > receiver = UnicastProcessor .create ();
351
+ final UnicastProcessor <Payload > receiver = UnicastProcessor .create (Queues .< Payload > one (). get () );
352
352
final AtomicBoolean once = new AtomicBoolean ();
353
353
354
354
return Flux .defer (
@@ -456,7 +456,7 @@ private Flux<Payload> handleChannel(Flux<Payload> request) {
456
456
private Flux <? extends Payload > handleChannel (Payload initialPayload , Flux <Payload > inboundFlux ) {
457
457
final UnboundedProcessor <ByteBuf > sendProcessor = this .sendProcessor ;
458
458
459
- final UnicastProcessor <Payload > receiver = UnicastProcessor .create ();
459
+ final UnicastProcessor <Payload > receiver = UnicastProcessor .create (Queues .< Payload > one (). get () );
460
460
461
461
return receiver
462
462
.transform (
Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright 2015-2018 the original author or authors.
2
+ * Copyright 2015-2020 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
48
48
import reactor .core .Exceptions ;
49
49
import reactor .core .publisher .*;
50
50
import reactor .util .annotation .Nullable ;
51
+ import reactor .util .concurrent .Queues ;
51
52
52
53
/** Responder side of RSocket. Receives {@link ByteBuf}s from a peer's {@link RSocketRequester} */
53
54
class RSocketResponder implements RSocket {
@@ -537,7 +538,7 @@ protected void hookOnError(Throwable throwable) {
537
538
}
538
539
539
540
private void handleChannel (int streamId , Payload payload , long initialRequestN ) {
540
- UnicastProcessor <Payload > frames = UnicastProcessor .create ();
541
+ UnicastProcessor <Payload > frames = UnicastProcessor .create (Queues .< Payload > one (). get () );
541
542
channelProcessors .put (streamId , frames );
542
543
543
544
Flux <Payload > payloads =
Original file line number Diff line number Diff line change @@ -158,13 +158,13 @@ public Flux<Payload> requestChannel(Publisher<Payload> payloads) {
158
158
}
159
159
160
160
@ Test (timeout = 2000 )
161
- public void testStream () throws Exception {
161
+ public void testStream () {
162
162
Flux <Payload > responses = rule .crs .requestStream (DefaultPayload .create ("Payload In" ));
163
163
StepVerifier .create (responses ).expectNextCount (10 ).expectComplete ().verify ();
164
164
}
165
165
166
166
@ Test (timeout = 2000 )
167
- public void testChannel () throws Exception {
167
+ public void testChannel () {
168
168
Flux <Payload > requests =
169
169
Flux .range (0 , 10 ).map (i -> DefaultPayload .create ("streaming in -> " + i ));
170
170
Flux <Payload > responses = rule .crs .requestChannel (requests );
@@ -543,6 +543,7 @@ public Mono<Payload> requestResponse(Payload payload) {
543
543
@ Override
544
544
public Flux <Payload > requestStream (Payload payload ) {
545
545
return Flux .range (1 , 10 )
546
+ .delaySubscription (Duration .ofMillis (100 ))
546
547
.map (
547
548
i -> DefaultPayload .create ("server got -> [" + payload .toString () + "]" ));
548
549
}
@@ -556,6 +557,7 @@ public Flux<Payload> requestChannel(Publisher<Payload> payloads) {
556
557
.subscribe ();
557
558
558
559
return Flux .range (1 , 10 )
560
+ .delaySubscription (Duration .ofMillis (100 ))
559
561
.map (
560
562
payload ->
561
563
DefaultPayload .create ("server got -> [" + payload .toString () + "]" ));
Original file line number Diff line number Diff line change @@ -49,6 +49,7 @@ public void testRangeButThrowException() {
49
49
}
50
50
})
51
51
.map (l -> DefaultPayload .create ("l -> " + l ))
52
+ .delaySubscription (Duration .ofMillis (100 ))
52
53
.cast (Payload .class )))
53
54
.bind (serverTransport )
54
55
.block ();
@@ -71,6 +72,7 @@ public void testRangeOfConsumers() {
71
72
payload ->
72
73
Flux .range (1 , 1000 )
73
74
.map (l -> DefaultPayload .create ("l -> " + l ))
75
+ .delaySubscription (Duration .ofMillis (100 ))
74
76
.cast (Payload .class )))
75
77
.bind (serverTransport )
76
78
.block ();
@@ -104,6 +106,7 @@ public void testSingleConsumer() {
104
106
payload ->
105
107
Flux .range (1 , 10_000 )
106
108
.map (l -> DefaultPayload .create ("l -> " + l ))
109
+ .delaySubscription (Duration .ofMillis (100 ))
107
110
.cast (Payload .class )))
108
111
.bind (serverTransport )
109
112
.block ();
You can’t perform that action at this time.
0 commit comments