Add a generic STREAM_CLOSED status

This commit is contained in:
Ravi Khadiwala authored and Jon Chambers committed 2026-06-17 08:32:47 -04:00
1 parent 9c393972e9
commit 4c0f454209
9 files changed
+129 -102

No files matched your search

@@ -8,6 +8,7 @@ import com.google.protobuf.ByteString;
import com.google.protobuf.Empty;
import java.util.Optional;
import java.util.concurrent.Flow;
import org.signal.chat.backup.BackupStreamClosed;
import org.signal.chat.backup.CopyMediaRequest;
import org.signal.chat.backup.CopyMediaResponse;
import org.signal.chat.backup.DeleteAllRequest;
@@ -228,10 +229,12 @@ public class BackupsAnonymousGrpcService extends SimpleBackupsAnonymousGrpc.Back
new MediaEncryptionParameters(item.getEncryptionKey().toByteArray(), item.getHmacKey().toByteArray()),
item.getMediaId().toByteArray())).toList(), maxAttachmentSize);
} catch (BackupFailedZkAuthenticationException e) {
return JdkFlowAdapter.publisherToFlowPublisher(Mono.just(CopyMediaResponse
.newBuilder()
.setFailedAuthentication(FailedZkAuthentication.newBuilder().setDescription(e.getMessage()))
.build()));
return JdkFlowAdapter.publisherToFlowPublisher(
Mono.error(GrpcExceptions.streamClosed(BackupStreamClosed.newBuilder()
.setFailedAuthentication(FailedZkAuthentication.newBuilder()
.setDescription(e.getMessage())
.build())
.build())));
}
return JdkFlowAdapter.publisherToFlowPublisher(backupManager.copyToBackup(copyQuota)
.doOnNext(result -> backupMetrics.updateCopyCounter(
@@ -308,10 +311,12 @@ public class BackupsAnonymousGrpcService extends SimpleBackupsAnonymousGrpc.Back
.map(item -> new BackupManager.StorageDescriptor(item.getCdn(), item.getMediaId().toByteArray()))
.toList());
} catch (BackupFailedZkAuthenticationException e) {
return JdkFlowAdapter.publisherToFlowPublisher(Mono.just(DeleteMediaResponse
.newBuilder()
.setFailedAuthentication(FailedZkAuthentication.newBuilder().setDescription(e.getMessage()))
.build()));
return JdkFlowAdapter.publisherToFlowPublisher(
Mono.error(GrpcExceptions.streamClosed(BackupStreamClosed.newBuilder()
.setFailedAuthentication(FailedZkAuthentication.newBuilder()
.setDescription(e.getMessage())
.build())
.build())));
}
return JdkFlowAdapter.publisherToFlowPublisher(deleteItems
.map(storageDescriptor -> DeleteMediaResponse.newBuilder()
@@ -39,7 +39,7 @@ public class ErrorConformanceInterceptor implements ServerInterceptor {
}
switch (status.getCode()) {
case UNAUTHENTICATED, UNAVAILABLE, INVALID_ARGUMENT, RESOURCE_EXHAUSTED -> {
case UNAUTHENTICATED, UNAVAILABLE, INVALID_ARGUMENT, RESOURCE_EXHAUSTED, ABORTED -> {
}
default -> {
log.error("Intercepted call {} returned illegal application status {}: {}",
@@ -39,6 +39,11 @@ public class GrpcExceptions {
.setReason("BAD_AUTHENTICATION")
.build());
private static final Any ERROR_INFO_STREAM_CLOSED = Any.pack(ErrorInfo.newBuilder()
.setDomain(DOMAIN)
.setReason("STREAM_CLOSED")
.build());
private static final com.google.rpc.Status UPGRADE_REQUIRED = com.google.rpc.Status.newBuilder()
.setCode(Status.Code.INVALID_ARGUMENT.value())
.setMessage("Upgrade required")
@@ -144,6 +149,20 @@ public class GrpcExceptions {
return StatusProto.toStatusRuntimeException(builder.build());
}
/// The server terminated the stream non-successfully for a reason specific to the RPC. The server must provide
/// additional information about the stream closure reason via the `streamClosedMessage`.
///
/// @param streamClosedMessage The additional domain-specific proto message that indicates the closure reason
/// @return A [StatusRuntimeException] encoding the error
public static <T extends com.google.protobuf.Message> StatusRuntimeException streamClosed(
final T streamClosedMessage) {
return StatusProto.toStatusRuntimeException(com.google.rpc.Status.newBuilder()
.setCode(Status.Code.ABORTED.value())
.addDetails(ERROR_INFO_STREAM_CLOSED)
.addDetails(Any.pack(streamClosedMessage))
.build());
}
public static StatusRuntimeException unavailable() {
return unavailable(null);
}
@@ -6,11 +6,13 @@ package org.whispersystems.textsecuregcm.grpc;
import com.google.common.annotations.VisibleForTesting;
import com.google.protobuf.Empty;
import io.grpc.StatusRuntimeException;
import io.micrometer.core.instrument.Metrics;
import java.time.Duration;
import java.util.UUID;
import javax.annotation.Nullable;
import org.signal.chat.messages.GetMessagesResponse;
import org.signal.chat.messages.GetMessagesStreamClosed;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.whispersystems.textsecuregcm.auth.DisconnectionRequestListener;
@@ -54,14 +56,10 @@ public class MessageDispatcher {
public static final GetMessagesResponse QUEUE_EMPTY_RESPONSE =
GetMessagesResponse.newBuilder().setQueueEmpty(Empty.getDefaultInstance()).build();
private static final GetMessagesResponse CONFLICTING_STREAM_RESPONSE = GetMessagesResponse.newBuilder()
.setTerminated(GetMessagesResponse.Terminated.newBuilder()
.setConflictingStream(Empty.getDefaultInstance()))
.build();
private static final GetMessagesResponse REAUTHENTICATION_REQUIRED_RESPONSE = GetMessagesResponse.newBuilder()
.setTerminated(GetMessagesResponse.Terminated.newBuilder()
.setReauthenticationRequired(Empty.getDefaultInstance()))
.build();
private static final StatusRuntimeException CONFLICTING_STREAM_EXCEPTION =
GrpcExceptions.streamClosed(GetMessagesStreamClosed.newBuilder()
.setConflictingStream(Empty.getDefaultInstance())
.build());
private static final String SEND_MESSAGES_FLUX_NAME = MetricsUtil.name(MessageDispatcher.class, "sendMessages");
@@ -99,8 +97,8 @@ public class MessageDispatcher {
/// terminates for any reason. The error from the client will be propagated to the returned flux. The stream may also
/// terminate with any other error encountered retrieving messages or processing acknowledgements.
///
/// The returned flux will emit a [GetMessagesResponse.Terminated] and then complete if
/// - A disconnection request (typically indicating a change in authorization credentials) is received.
/// The returned flux will error with a [GrpcExceptions#streamClosed] non-ok status exception if:
/// - A disconnection request (typically indicating a change in authorization credentials) is received
/// - A client requests messages for the same account/device while this stream is still active
///
/// When the stream terminates for any reason and the client has messages remaining in their queue, a push
@@ -167,7 +165,11 @@ public class MessageDispatcher {
pendingAcknowledgementTracker.markEndOfQueue();
yield Mono.empty();
}
}, MAX_UNACKED_MESSAGES);
}, MAX_UNACKED_MESSAGES)
.onErrorMap(ConflictingMessageConsumerException.class, _ -> {
messageMetrics.measureMessageStreamDisplaced(MessageMetrics.GRPC_CHANNEL, userAgent, true);
return CONFLICTING_STREAM_EXCEPTION;
});
// Only emit envelopes when the permit flux emits a value. Initially it is seeded MAX_UNACKED_MESSAGES permits,
// after that a permit is emitted every time we receive an ack.
@@ -204,18 +206,8 @@ public class MessageDispatcher {
ackCompletions,
// Emits a queue empty once all messages prior to the queueEmpty signal have been acked
pendingAcknowledgementTracker.queueDrained(),
// Emit a Terminated response if we receive a disconnection request
disconnectionSignal(account, device))
.onErrorResume(ConflictingMessageConsumerException.class, _ -> Mono.just(CONFLICTING_STREAM_RESPONSE))
.takeUntil(response -> switch (response.getResponseCase()) {
case ENVELOPE, QUEUE_EMPTY -> false;
case TERMINATED -> {
messageMetrics.measureMessageStreamDisplaced(MessageMetrics.GRPC_CHANNEL, userAgent,
response.getTerminated().hasConflictingStream());
yield true;
}
case RESPONSE_NOT_SET -> throw new IllegalStateException("tried to return an invalid GetMessagesResponse");
})
// Emit an invalid credentials error if we receive a disconnection request
disconnectionSignal(account, device, userAgent))
.doFinally(_ -> maybeSchedulePush(account, device));
}
@@ -232,11 +224,14 @@ public class MessageDispatcher {
/// Watch for a disconnection signal from the [DisconnectionRequestManager]
///
/// @return Mono that completes with a [org.signal.chat.messages.GetMessagesResponse.Terminated] response if the
/// @return Mono that completes with an `InvalidCredentials` status if the
/// device receives a disconnection request
private Mono<GetMessagesResponse> disconnectionSignal(final Account account, final Device device) {
private Mono<GetMessagesResponse> disconnectionSignal(final Account account, final Device device, final UserAgent userAgent) {
return Mono.create(sink -> {
final DisconnectionRequestListener listener = () -> sink.success(REAUTHENTICATION_REQUIRED_RESPONSE);
final DisconnectionRequestListener listener = () -> {
messageMetrics.measureMessageStreamDisplaced(MessageMetrics.GRPC_CHANNEL, userAgent, false);
sink.error(GrpcExceptions.invalidCredentials("reauthentication required"));
};
disconnectionRequestManager.addListener(account.getUuid(), device.getId(), listener);
sink.onDispose(() -> disconnectionRequestManager.removeListener(account.getUuid(), device.getId(), listener));
});
@@ -34,14 +34,15 @@ The server may set the `reason` to match the enum string for the `Status.Code` i
The chat server may return the following errors from any RPC
| Status Code | Reason | Description |
| :---- | :---- |:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `INVALID_ARGUMENT` | `UPGRADE_REQUIRED` | The client version provided in the `User-Agent` is no longer supported. The client must upgrade to use the service. |
| `INVALID_ARGUMENT` | `CONSTRAINT_VIOLATED` | The RPC argument violated a constraint that was annotated or documented in the service definition. It is always possible to check this constraint without communicating with the chat server. This always represents a client bug or out of date client. <br><br> The `details` may include a [`BadRequest` message](https://github.com/googleapis/googleapis/blob/8c06c1e04ae562f49f411357577c700e9142f33c/google/rpc/error_details.proto#L236) that indicates additional information about the invalid field. |
| `INVALID_ARGUMENT` | `BAD_AUTHENTICATION` | The request has incorrectly set authentication credentials for the RPC. This represents a client bug where the authorization mode is not correct for the RPC. For example, <br><br> The RPC was for an anonymous service, but included an Authentication header in the RPC metadata. <br><br>The RPC should only be made by the primary device, but the request had linked device credentials. |
| `UNAUTHENTICATED` | `INVALID_CREDENTIALS` | The account credentials provided in the authorization header are not valid. |
| `RESOURCE_EXHAUSTED` | `RESOURCE_EXHAUSTED` | A server-side resource was exhausted. The `details` field may include a [`RetryInfo` message](https://github.com/googleapis/googleapis/blob/8c06c1e04ae562f49f411357577c700e9142f33c/google/rpc/error_details.proto#L92) that includes the amount of time in seconds the client should wait before retrying the request. <br><br> If a `RetryInfo` is present, the client must wait the indicated time before retrying the request. If absent, the client should retry with an exponential backoff. |
| `UNAVAILABLE` | `UNAVAILABLE` | There was an internal error processing the RPC. The client should retry the request with exponential backoff. |
| Status Code | Reason | Description |
|:---------------------|:----------------------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `INVALID_ARGUMENT` | `UPGRADE_REQUIRED` | The client version provided in the `User-Agent` is no longer supported. The client must upgrade to use the service. |
| `INVALID_ARGUMENT` | `CONSTRAINT_VIOLATED` | The RPC argument violated a constraint that was annotated or documented in the service definition. It is always possible to check this constraint without communicating with the chat server. This always represents a client bug or out of date client. <br><br> The `details` may include a [`BadRequest` message](https://github.com/googleapis/googleapis/blob/8c06c1e04ae562f49f411357577c700e9142f33c/google/rpc/error_details.proto#L236) that indicates additional information about the invalid field. |
| `INVALID_ARGUMENT` | `BAD_AUTHENTICATION` | The request has incorrectly set authentication credentials for the RPC. This represents a client bug where the authorization mode is not correct for the RPC. For example, <br><br> The RPC was for an anonymous service, but included an Authentication header in the RPC metadata. <br><br>The RPC should only be made by the primary device, but the request had linked device credentials. |
| `UNAUTHENTICATED` | `INVALID_CREDENTIALS` | The account credentials provided in the authorization header are not valid. |
| `RESOURCE_EXHAUSTED` | `RESOURCE_EXHAUSTED` | A server-side resource was exhausted. The `details` field may include a [`RetryInfo` message](https://github.com/googleapis/googleapis/blob/8c06c1e04ae562f49f411357577c700e9142f33c/google/rpc/error_details.proto#L92) that includes the amount of time in seconds the client should wait before retrying the request. <br><br> If a `RetryInfo` is present, the client must wait the indicated time before retrying the request. If absent, the client should retry with an exponential backoff. |
| `ABORTED` | `STREAM_CLOSED` | The server terminated a streaming RPC for some domain specific reason. The `details` field must include a message with additional information about why the stream was closed. This message must be defined in the corresponding service proto for the streaming RPC. This status must only be returned from server-side streaming RPCs. Clients must handle a STREAM_CLOSED status even if no corresponding message is defined in the version of the proto they are targeting. Unless otherwise noted, if a stream termination message is defined, clients must handle the error at any point in the message stream. |
| `UNAVAILABLE` | `UNAVAILABLE` | There was an internal error processing the RPC. The client should retry the request with exponential backoff. |
### Logging Errors
@@ -183,6 +183,9 @@ service BackupsAnonymous {
//
// On retries, a particular destination media id must not be reused with a
// different source media id or different encryption parameters.
//
// The response stream may be closed with STREAM_CLOSED error reason. In this
// case, a BackupStreamClosed message will be present in the error details.
rpc CopyMedia(CopyMediaRequest) returns (stream CopyMediaResponse) {}
// Retrieve a page of media objects stored for this backup-id. A client may
@@ -194,6 +197,9 @@ service BackupsAnonymous {
// Delete media objects stored with this backup-id. Streams the locations of
// media items back when the item has successfully been removed.
//
// The response stream may be closed with STREAM_CLOSED error reason. In this
// case, a BackupStreamClosed message will be present in the error details.
rpc DeleteMedia(DeleteMediaRequest) returns (stream DeleteMediaResponse) {}
// Delete all backup metadata, objects, and stored public key. To use
@@ -439,20 +445,25 @@ message CopyMediaResponse {
// The media item was successfully copied into the backup
CopySuccess success = 2;
// The source object was not found
SourceNotFound source_not_found = 3 [(tag.reason) = "source_not_found"];
// The provided object length was incorrect
WrongSourceLength wrong_source_length = 4 [(tag.reason) = "wrong_source_length"];
// All media capacity has been consumed. Free some space to continue.
OutOfSpace out_of_space = 5 [(tag.reason) = "out_of_space"];
}
}
// The reason why a media stream RPC is being prematurely closed by the server.
message BackupStreamClosed {
oneof reason {
// The provided backup auth credential presentation could not be
// authenticated. Either, the presentation could not be verified, or
// the public key signature was invalid, or there is no backup associated
// with the backup-id in the presentation.
errors.FailedZkAuthentication failed_authentication = 3 [(tag.reason) = "failed_authentication"];
// The source object was not found
SourceNotFound source_not_found = 4 [(tag.reason) = "source_not_found"];
// The provided object length was incorrect
WrongSourceLength wrong_source_length = 5 [(tag.reason) = "wrong_source_length"];
// All media capacity has been consumed. Free some space to continue.
OutOfSpace out_of_space = 6 [(tag.reason) = "out_of_space"];
errors.FailedZkAuthentication failed_authentication = 1 [(tag.reason) = "failed_authentication"];
}
}
@@ -537,13 +548,5 @@ message DeleteMediaRequest {
}
message DeleteMediaResponse {
oneof response {
DeleteMediaItem deleted_item = 1;
// The provided backup auth credential presentation could not be
// authenticated. Either, the presentation could not be verified, or
// the public key signature was invalid, or there is no backup associated
// with the backup-id in the presentation.
errors.FailedZkAuthentication failed_authentication = 2 [(tag.reason) = "failed_authentication"];
}
DeleteMediaItem deleted_item = 1;
}
@@ -43,8 +43,11 @@ service Messages {
// Only the first GetMessagesRequest may contain request parameters that
// configure the stream. The first request must not contain an ack.
//
// The server will keep the stream open until the client disconnects or the
// connection is displaced as indicated by a Terminated response.
// The server will keep the stream open until the client disconnects. Only
// one GetMessages stream may be open per device. If a second GetMessages
// stream is opened, the server may terminate any of the streams with
// a STREAM_CLOSED error reason. A GetMessagesStreamClosed message will be
// present in the error details.
rpc GetMessages(stream GetMessagesRequest) returns (stream GetMessagesResponse) {}
}
@@ -68,19 +71,15 @@ message GetMessagesRequest {
}
}
message GetMessagesResponse {
// The reason why a GetMessages RPC is being closed by the server.
message Terminated {
oneof reason {
// The account's credentials have been updated and the caller must reauthenticate.
google.protobuf.Empty reauthentication_required = 1;
// Another caller has opened a GetMessages stream for the same device.
google.protobuf.Empty conflicting_stream = 2;
}
// The reason why a GetMessages RPC is being closed by the server.
message GetMessagesStreamClosed {
oneof reason {
// Another caller has opened a GetMessages stream for the same device.
google.protobuf.Empty conflicting_stream = 1;
}
}
message GetMessagesResponse {
oneof response {
// A message. On successful receipt of an envelope the caller should ack
// the envelope by sending a GetMessagesRequest with the envelope's server
@@ -92,9 +91,6 @@ message GetMessagesResponse {
// drained and acked by the client. The stream will remain open and continue
// to deliver newly arrived messages.
google.protobuf.Empty queue_empty = 2;
// Indicates that the stream is about to be closed.
Terminated terminated = 3;
}
}
@@ -7,6 +7,7 @@ package org.whispersystems.textsecuregcm.grpc;
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertInstanceOf;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.mockito.Mockito.verifyNoInteractions;
@@ -33,6 +34,12 @@ public final class GrpcTestUtils {
return exception;
}
public static void assertStatusException(final Status expected, final String expectedReason, final Throwable throwable) {
final StatusRuntimeException exception = Assertions.assertInstanceOf(StatusRuntimeException.class, throwable);
assertEquals(expected.getCode(), exception.getStatus().getCode());
assertEquals(expectedReason, extractErrorInfo(exception).getReason());
}
public static void assertStatusException(final Status expected, final String expectedReason, final Executable serviceCall) {
final StatusRuntimeException exception = Assertions.assertThrows(StatusRuntimeException.class, serviceCall);
assertEquals(expected.getCode(), exception.getStatus().getCode());
@@ -43,14 +50,6 @@ public final class GrpcTestUtils {
return assertStatusException(Status.INVALID_ARGUMENT, serviceCall);
}
public static StatusRuntimeException assertStatusUnauthenticated(final Executable serviceCall) {
return assertStatusException(Status.UNAUTHENTICATED, serviceCall);
}
public static StatusRuntimeException assertStatusPermissionDenied(final Executable serviceCall) {
return assertStatusException(Status.PERMISSION_DENIED, serviceCall);
}
public static void assertRateLimitExceeded(
final Duration expectedRetryAfter,
final Executable serviceCall,
@@ -71,6 +70,13 @@ public final class GrpcTestUtils {
}
}
public static <T extends Message> T assertStreamClosed(final Class<T> streamClosedMessageClass, final Throwable exception) {
final StatusRuntimeException statusRuntimeException = assertInstanceOf(StatusRuntimeException.class, exception);
final ErrorInfo errorInfo = extractErrorInfo(statusRuntimeException);
assertEquals("STREAM_CLOSED", errorInfo.getReason());
return extractDetail(streamClosedMessageClass, statusRuntimeException);
}
public static ErrorInfo extractErrorInfo(final StatusRuntimeException exception) {
return extractDetail(ErrorInfo.class, exception);
}
@@ -5,6 +5,7 @@
package org.whispersystems.textsecuregcm.grpc;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyLong;
import static org.mockito.ArgumentMatchers.eq;
@@ -17,6 +18,7 @@ import static org.mockito.Mockito.when;
import com.google.protobuf.ByteString;
import com.google.protobuf.Empty;
import io.grpc.Status;
import java.nio.charset.StandardCharsets;
import java.time.Duration;
import java.util.Arrays;
@@ -30,6 +32,7 @@ import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;
import org.mockito.ArgumentCaptor;
import org.signal.chat.messages.GetMessagesResponse;
import org.signal.chat.messages.GetMessagesStreamClosed;
import org.whispersystems.textsecuregcm.auth.DisconnectionRequestListener;
import org.whispersystems.textsecuregcm.auth.DisconnectionRequestManager;
import org.whispersystems.textsecuregcm.entities.MessageProtos;
@@ -59,16 +62,6 @@ class MessageDispatcherTest {
private static final GetMessagesResponse QUEUE_EMPTY =
GetMessagesResponse.newBuilder().setQueueEmpty(Empty.getDefaultInstance()).build();
private static final GetMessagesResponse REQUIRES_REAUTH = GetMessagesResponse.newBuilder()
.setTerminated(GetMessagesResponse.Terminated.newBuilder()
.setReauthenticationRequired(Empty.getDefaultInstance())
.build())
.build();
private static final GetMessagesResponse CONFLICTING_STREAM = GetMessagesResponse.newBuilder()
.setTerminated(GetMessagesResponse.Terminated.newBuilder()
.setConflictingStream(Empty.getDefaultInstance())
.build())
.build();
private static final UUID ACI = UUID.randomUUID();
private static final byte DEVICE_ID = 2;
@@ -296,8 +289,17 @@ class MessageDispatcherTest {
verify(disconnectionRequestManager).addListener(eq(ACI), eq(DEVICE_ID), listener.capture());
listener.getValue().handleDisconnectionRequest();
})
.expectNext(REQUIRES_REAUTH)
.verifyComplete();
.expectErrorSatisfies(MessageDispatcherTest::assertReauthError)
.verify();
}
private static void assertReauthError(final Throwable e) {
GrpcTestUtils.assertStatusException(Status.UNAUTHENTICATED, "INVALID_CREDENTIALS", e);
}
private static void assertConflictError(final Throwable e) {
final GetMessagesStreamClosed reason = GrpcTestUtils.assertStreamClosed(GetMessagesStreamClosed.class, e);
assertEquals(GetMessagesStreamClosed.ReasonCase.CONFLICTING_STREAM, reason.getReasonCase());
}
@Test
@@ -306,8 +308,8 @@ class MessageDispatcherTest {
final Flux<GetMessagesResponse> responses =
dispatcher.getMessages(true, TEST_UA, account, device, Flux.never());
StepVerifier.create(responses)
.expectNext(CONFLICTING_STREAM)
.verifyComplete();
.expectErrorSatisfies(MessageDispatcherTest::assertConflictError)
.verify();
}
@Test
@@ -329,8 +331,8 @@ class MessageDispatcherTest {
.expectNoEvent(Duration.ofMillis(1))
// The error should make it to us immediately even though there are max-unacked messages outstanding
.then(() -> source.error(new ConflictingMessageConsumerException()))
.expectNext(CONFLICTING_STREAM)
.verifyComplete();
.expectErrorSatisfies(MessageDispatcherTest::assertConflictError)
.verify();
}
/// Set envelopes to return when a message stream is created. A [MessageStreamEntry.QueueEmpty] will be emitted after