Expected Behavior
Regardles whether someone uses rsocket.metadataPush(...).block(); or rsocket.metadataPush(...).subscribe(...);, the behavior (besides the blocking aspect) should be identical.
Actual Behavior
When using the block() method, the operation results in a java.lang.IllegalArgumentException: Metadata push does not support metadata field. The subscribe() method does produce the expected result.
Steps to Reproduce
Mono<CloseableChannel> server = RSocketServer.create()
.acceptor((setup, sendingSocket) -> Mono.just(new RSocket() {
@Override
public Mono<Void> metadataPush(Payload payload) {
return Mono.empty();
}
}))
.bind(TcpServerTransport.create(8024));
CloseableChannel closeable = server.blockOptional().orElseThrow();
try {
RSocket client = RSocketConnector.connectWith(TcpClientTransport.create(8024))
.block();
assertDoesNotThrow(() -> client.metadataPush(DefaultPayload.create("ignored", "payload")).block());
} finally {
closeable.dispose();
}
Possible Solution
The MetadataPushRequesterMono class implements a block() method with clearly different semantics than the subscribe() method. Since that class extends Mono, the whole block() method is probably unnecessary. The implementation can use the block() implementation of Mono, which calls the subscribe() using a BlockingMonoSubscriber
Looking at the implementation of BlockingMonoSubscriber it also seems that the block(Duration) implementation doesn't take the given duration into account. Removing the method would use Mono's implementation, which does only block for the given duration.
Your Environment
- RSocket version(s) used: 1.1.0 and 1.1.1 produce the issue. 1.0.4 doesn't.
- For the test case, I used
rsocket-core and rsocket-transport-netty
Expected Behavior
Regardles whether someone uses
rsocket.metadataPush(...).block();orrsocket.metadataPush(...).subscribe(...);, the behavior (besides the blocking aspect) should be identical.Actual Behavior
When using the
block()method, the operation results in ajava.lang.IllegalArgumentException: Metadata push does not support metadata field. Thesubscribe()method does produce the expected result.Steps to Reproduce
Possible Solution
The
MetadataPushRequesterMonoclass implements ablock()method with clearly different semantics than thesubscribe()method. Since that class extends Mono, the whole block() method is probably unnecessary. The implementation can use the block() implementation of Mono, which calls the subscribe() using aBlockingMonoSubscriberLooking at the implementation of
BlockingMonoSubscriberit also seems that theblock(Duration)implementation doesn't take the given duration into account. Removing the method would useMono's implementation, which does only block for the given duration.Your Environment
rsocket-coreandrsocket-transport-netty