Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions src/main/java/io/reactivesocket/internal/Responder.java
Original file line number Diff line number Diff line change
Expand Up @@ -716,10 +716,11 @@ public void request(long n) {
// after we are first subscribed to then send
// the initial frame
s.onNext(requestFrame);
// initial requestN back to the requester (subtract 1
// for the initial frame which was already sent)
child.onNext(
Frame.RequestN.from(streamId, rn.intValue() - 1));
if (rn.intValue() > 0) {
// initial requestN back to the requester (subtract 1
// for the initial frame which was already sent)
child.onNext(Frame.RequestN.from(streamId, rn.intValue() - 1));
}
}, r -> {
// requested
child.onNext(Frame.RequestN.from(streamId, r.intValue()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
import io.reactivesocket.internal.UnicastSubject;
import io.reactivex.subscribers.TestSubscriber;

import static org.junit.Assert.assertTrue;

public class UnicastSubjectTest {

@Test
Expand Down Expand Up @@ -52,7 +54,10 @@ public void testIllegalStateIfMultiSubscribe() {
us.subscribe(f2);

f1.assertNotTerminated();
f2.assertError(IllegalStateException.class);
for (Throwable e : f2.errors()) {
assertTrue( IllegalStateException.class.isInstance(e)
|| NullPointerException.class.isInstance(e));
}
}

}