Compare commits

..
21 changed files with 128 additions and 250 deletions

No files matched your search

+1 -1
View File
@@ -1 +1 @@
temurin-26
temurin-27
+16 -2
View File
@@ -47,6 +47,10 @@
<properties>
<aws.sdk2.version>2.57.3</aws.sdk2.version>
<braintree.version>3.55.1</braintree.version>
<!-- Weird stuff happens with parameter annotation counts under Java 27 with versions of Byte Buddy older than
1.18.9, so we need to pull in a newer version than we'd get via Dropwizard -> Mockito -> Byte Buddy. We can drop
this when Dropwizard updates and pulls in a newer version of Byte Buddy. -->
<byte-buddy.version>1.18.15-jdk5</byte-buddy.version>
<commons-csv.version>1.14.1</commons-csv.version>
<commons-io.version>2.22.0</commons-io.version>
<dropwizard.version>5.0.2</dropwizard.version>
@@ -100,7 +104,7 @@
<redis.image>redis:7.4-alpine@sha256:6ab0b6e7381779332f97b8ca76193e45b0756f38d4c0dcda72dbb3c32061ab99</redis.image>
<redis-cluster.image>docker.io/bitnamilegacy/redis-cluster:7.4.3@sha256:a53d023fdfaf8a8d7ddc58da040d3494e4cb45772644618ffa44c42dcd32b9af</redis-cluster.image>
<docker.image>eclipse-temurin:26-jre-resolute@sha256:c3b6e31e48772c98e8868654e5f21fb2c3670e67c055ddd76d8cf37e62113eb5</docker.image>
<docker.image>eclipse-temurin:27-jre-resolute@sha256:492896faf0de16f8959951fcc97e84d6b1db7b1cbc327e732b4e740cd27409e9</docker.image>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
@@ -176,6 +180,16 @@
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>net.bytebuddy</groupId>
<artifactId>byte-buddy</artifactId>
<version>${byte-buddy.version}</version>
</dependency>
<dependency>
<groupId>net.bytebuddy</groupId>
<artifactId>byte-buddy-agent</artifactId>
<version>${byte-buddy.version}</version>
</dependency>
<!-- Needed for gRPC with Java 9+ -->
<dependency>
<groupId>org.apache.tomcat</groupId>
@@ -563,7 +577,7 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>3.16.0</version>
<configuration>
<release>26</release>
<release>27</release>
</configuration>
</plugin>
@@ -833,7 +833,7 @@ public class WhisperServerService extends Application<WhisperServerConfiguration
APNSender apnSender = new APNSender(apnSenderExecutor, Clock.systemUTC(), config.getApnConfiguration());
FcmSender fcmSender = new FcmSender(fcmSenderExecutor, config.getFcmConfiguration().credentials().value());
PushNotificationScheduler pushNotificationScheduler = new PushNotificationScheduler(pushSchedulerCluster,
apnSender, fcmSender, accountsManager, 0, 0, retryExecutor);
apnSender, fcmSender, accountsManager, 0, 0);
PushNotificationManager pushNotificationManager =
new PushNotificationManager(accountsManager, apnSender, fcmSender, pushNotificationScheduler);
RateLimiters rateLimiters = RateLimiters.create(dynamicConfigurationManager, rateLimitersCluster, retryExecutor);
@@ -1112,7 +1112,7 @@ public class WhisperServerService extends Application<WhisperServerConfiguration
final GroupSendTokenUtil groupSendTokenUtil = new GroupSendTokenUtil(groupZkSecretParams, Clock.systemUTC());
final MessageMetrics messageMetrics = new MessageMetrics();
final MessageDispatcher messageDispatcher = new MessageDispatcher(receiptSender, messagesManager, messageMetrics,
pushNotificationManager, pushNotificationScheduler, disconnectionRequestManager, clientReleaseManager);
pushNotificationManager, disconnectionRequestManager, clientReleaseManager, Clock.systemUTC());
final CertificateGenerator certificateGenerator =
new CertificateGenerator(config.getDeliveryCertificate().certificate(),
@@ -15,7 +15,7 @@ public class BulkheadConfiguration {
@JsonProperty
@Min(1)
private int maxConcurrentCalls = BulkheadConfig.DEFAULT_MAX_CONCURRENT_CALLS;
private int maxConcurrentCalls = 256;
@JsonProperty
@NotNull
@@ -8,6 +8,8 @@ import com.google.common.annotations.VisibleForTesting;
import com.google.protobuf.Empty;
import io.grpc.StatusRuntimeException;
import io.micrometer.core.instrument.Metrics;
import java.time.Clock;
import java.time.Duration;
import java.util.UUID;
import javax.annotation.Nullable;
@@ -20,8 +22,8 @@ import org.whispersystems.textsecuregcm.auth.DisconnectionRequestManager;
import org.whispersystems.textsecuregcm.entities.MessageProtos;
import org.whispersystems.textsecuregcm.metrics.MessageMetrics;
import org.whispersystems.textsecuregcm.metrics.MetricsUtil;
import org.whispersystems.textsecuregcm.push.NotPushRegisteredException;
import org.whispersystems.textsecuregcm.push.PushNotificationManager;
import org.whispersystems.textsecuregcm.push.PushNotificationScheduler;
import org.whispersystems.textsecuregcm.push.ReceiptSender;
import org.whispersystems.textsecuregcm.storage.Account;
import org.whispersystems.textsecuregcm.storage.ClientReleaseManager;
@@ -51,8 +53,6 @@ public class MessageDispatcher {
static final Duration CLOSE_WITH_PENDING_MESSAGES_NOTIFICATION_DELAY = Duration.ofMinutes(1);
private static final int MESSAGE_PUBLISHER_LIMIT_RATE = 100;
public static final GetMessagesResponse QUEUE_EMPTY_RESPONSE =
GetMessagesResponse.newBuilder().setQueueEmpty(Empty.getDefaultInstance()).build();
private static final StatusRuntimeException CONFLICTING_STREAM_EXCEPTION =
GrpcExceptions.streamClosed(GetMessagesStreamClosed.newBuilder()
.setConflictingStream(Empty.getDefaultInstance())
@@ -64,24 +64,24 @@ public class MessageDispatcher {
private final MessagesManager messagesManager;
private final MessageMetrics messageMetrics;
private final PushNotificationManager pushNotificationManager;
private final PushNotificationScheduler pushNotificationScheduler;
private final ClientReleaseManager clientReleaseManager;
private final DisconnectionRequestManager disconnectionRequestManager;
private final Clock clock;
public MessageDispatcher(final ReceiptSender receiptSender,
final MessagesManager messagesManager,
final MessageMetrics messageMetrics,
final PushNotificationManager pushNotificationManager,
final PushNotificationScheduler pushNotificationScheduler,
final DisconnectionRequestManager disconnectionRequestManager,
final ClientReleaseManager clientReleaseManager) {
final ClientReleaseManager clientReleaseManager,
final Clock clock) {
this.receiptSender = receiptSender;
this.messagesManager = messagesManager;
this.messageMetrics = messageMetrics;
this.pushNotificationManager = pushNotificationManager;
this.pushNotificationScheduler = pushNotificationScheduler;
this.disconnectionRequestManager = disconnectionRequestManager;
this.clientReleaseManager = clientReleaseManager;
this.clock = clock;
}
/// Retrieve messages for the device.
@@ -147,7 +147,7 @@ public class MessageDispatcher {
final MessageProtos.Envelope stripped = envelope.toBuilder().clearEphemeral().build();
messageMetrics.measureAccountEnvelopeUuidMismatches(account, envelope);
messageMetrics.measureMessageSent(stripped.getSerializedSize());
yield Mono.just(GetMessagesResponse.newBuilder().setEnvelope(stripped).build());
yield Mono.just(GetMessagesResponse.newBuilder().setEnvelope(stripped).setServerTimeEpochMillis(clock.millis()).build());
}
case MessageStreamEntry.QueueEmpty _ -> {
pendingAcknowledgementTracker.markEndOfQueue();
@@ -193,19 +193,22 @@ public class MessageDispatcher {
// Will only emit errors, but those should terminate the stream
ackCompletions,
// Emits a queue empty once all messages prior to the queueEmpty signal have been acked
pendingAcknowledgementTracker.queueDrained(),
pendingAcknowledgementTracker.queueDrained().map(
_ -> GetMessagesResponse.newBuilder().setQueueEmpty(Empty.getDefaultInstance()).setServerTimeEpochMillis(clock.millis()).build()),
// Emit an invalid credentials error if we receive a disconnection request
disconnectionSignal(account, device, userAgent))
.doFinally(_ -> maybeSchedulePush(account, device));
.doFinally(_ -> maybeSendNewMessagePushNotification(account, device));
}
/// If the device potentially has more messages available, schedule a push notification.
private void maybeSchedulePush(final Account account, final Device device) {
/// If the device potentially has more messages available, send a push notification.
private void maybeSendNewMessagePushNotification(final Account account, final Device device) {
messagesManager.mayHaveMessages(account.getAccountIdentifier(), device)
.thenAccept(mayHaveMessages -> {
if (mayHaveMessages) {
pushNotificationScheduler.scheduleDelayedNotification(account, device,
CLOSE_WITH_PENDING_MESSAGES_NOTIFICATION_DELAY);
try {
pushNotificationManager.sendNewMessageNotification(account, device.getId(), true);
} catch (NotPushRegisteredException _) {
}
}
});
}
@@ -9,7 +9,6 @@ import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicLong;
import javax.annotation.Nullable;
import org.signal.chat.messages.GetMessagesResponse;
import org.whispersystems.textsecuregcm.entities.MessageProtos;
import org.whispersystems.textsecuregcm.identity.AciServiceIdentifier;
import org.whispersystems.textsecuregcm.identity.ServiceIdentifier;
@@ -39,9 +38,8 @@ class PendingAcknowledgementTracker {
private final ConcurrentHashMap<UUID, UnacknowledgedEnvelope> unacknowledgedEnvelopes = new ConcurrentHashMap<>();
private final AtomicLong sentMessageCounter = new AtomicLong();
private final Sinks.One<GetMessagesResponse> queueDrained = Sinks.one();
private final ClosableEpoch queueDrainEpoch = new ClosableEpoch(() ->
queueDrained.tryEmitValue(MessageDispatcher.QUEUE_EMPTY_RESPONSE));
private final Sinks.One<Boolean> queueDrained = Sinks.one();
private final ClosableEpoch queueDrainEpoch = new ClosableEpoch(() -> queueDrained.tryEmitValue(true));
private final Timer.Sample queueDrainStart = Timer.start();
private final MessageMetrics messageMetrics;
@@ -92,7 +90,7 @@ class PendingAcknowledgementTracker {
///
/// @return A mono that completes with a QueueEmpty response when all messages tracked before [#markEndOfQueue] have
/// been acknowledged.
Mono<GetMessagesResponse> queueDrained() {
Mono<Boolean> queueDrained() {
return queueDrained.asMono();
}
@@ -23,7 +23,6 @@ import java.util.Optional;
import java.util.UUID;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionStage;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicLong;
import java.util.function.BiFunction;
@@ -38,7 +37,6 @@ import org.whispersystems.textsecuregcm.storage.Device;
import org.whispersystems.textsecuregcm.util.ExceptionUtils;
import org.whispersystems.textsecuregcm.util.Pair;
import org.whispersystems.textsecuregcm.util.RedisClusterUtil;
import org.whispersystems.textsecuregcm.util.ResilienceUtil;
import org.whispersystems.textsecuregcm.util.Util;
import reactor.core.publisher.Mono;
@@ -49,7 +47,6 @@ public class PushNotificationScheduler implements Managed {
private static final String PENDING_BACKGROUND_APN_NOTIFICATIONS_KEY_PREFIX = "PENDING_BACKGROUND_APN";
private static final String PENDING_BACKGROUND_FCM_NOTIFICATIONS_KEY_PREFIX = "PENDING_BACKGROUND_FCM";
private static final String LAST_BACKGROUND_NOTIFICATION_TIMESTAMP_KEY_PREFIX = "LAST_BACKGROUND_NOTIFICATION";
private static final String PENDING_DELAYED_NOTIFICATIONS_KEY_PREFIX = "DELAYED";
@VisibleForTesting
static final String NEXT_SLOT_TO_PROCESS_KEY = "pending_notification_next_slot";
@@ -59,16 +56,12 @@ public class PushNotificationScheduler implements Managed {
private static final String BACKGROUND_NOTIFICATION_SCHEDULED_COUNTER_NAME = name(PushNotificationScheduler.class, "backgroundNotification", "scheduled");
private static final String BACKGROUND_NOTIFICATION_SENT_COUNTER_NAME = name(PushNotificationScheduler.class, "backgroundNotification", "sent");
private static final String DELAYED_NOTIFICATION_SCHEDULED_COUNTER_NAME = name(PushNotificationScheduler.class, "delayedNotificationScheduled");
private static final String DELAYED_NOTIFICATION_SENT_COUNTER_NAME = name(PushNotificationScheduler.class, "delayedNotificationSent");
private static final String TOKEN_TYPE_TAG = "tokenType";
private static final String ACCEPTED_TAG = "accepted";
private final APNSender apnSender;
private final FcmSender fcmSender;
private final AccountsManager accountsManager;
private final FaultTolerantRedisClusterClient pushSchedulingCluster;
private final ScheduledExecutorService retryExecutor;
private final Clock clock;
private final ClusterLuaScript scheduleBackgroundNotificationScript;
@@ -80,8 +73,6 @@ public class PushNotificationScheduler implements Managed {
private final AtomicBoolean running = new AtomicBoolean(false);
private static final String RETRY_NAME = ResilienceUtil.name(PushNotificationScheduler.class);
class NotificationWorker implements Runnable {
private final int maxConcurrency;
@@ -118,8 +109,7 @@ public class PushNotificationScheduler implements Managed {
connection.sync().incr(NEXT_SLOT_TO_PROCESS_KEY)) % SlotHash.SLOT_COUNT);
return processScheduledBackgroundNotifications(PushNotification.TokenType.APN, slot)
+ processScheduledBackgroundNotifications(PushNotification.TokenType.FCM, slot)
+ processScheduledDelayedNotifications(slot);
+ processScheduledBackgroundNotifications(PushNotification.TokenType.FCM, slot);
}
@VisibleForTesting
@@ -129,12 +119,6 @@ public class PushNotificationScheduler implements Managed {
}
@VisibleForTesting
long processScheduledDelayedNotifications(final int slot) {
return processScheduledNotifications(getDelayedNotificationQueueKey(slot),
PushNotificationScheduler.this::sendDelayedNotification);
}
private long processScheduledNotifications(final String queueKey,
final BiFunction<Account, Device, CompletableFuture<Void>> sendNotificationFunction) {
@@ -163,8 +147,7 @@ public class PushNotificationScheduler implements Managed {
final FcmSender fcmSender,
final AccountsManager accountsManager,
final int dedicatedProcessWorkerThreadCount,
final int workerMaxConcurrency,
final ScheduledExecutorService retryExecutor) throws IOException {
final int workerMaxConcurrency) throws IOException {
this(pushSchedulingCluster,
apnSender,
@@ -172,8 +155,7 @@ public class PushNotificationScheduler implements Managed {
accountsManager,
Clock.systemUTC(),
dedicatedProcessWorkerThreadCount,
workerMaxConcurrency,
retryExecutor);
workerMaxConcurrency);
}
@VisibleForTesting
@@ -183,8 +165,7 @@ public class PushNotificationScheduler implements Managed {
final AccountsManager accountsManager,
final Clock clock,
final int dedicatedProcessThreadCount,
final int workerMaxConcurrency,
final ScheduledExecutorService retryExecutor) throws IOException {
final int workerMaxConcurrency) throws IOException {
this.apnSender = apnSender;
this.fcmSender = fcmSender;
@@ -196,7 +177,6 @@ public class PushNotificationScheduler implements Managed {
"lua/apn/schedule_background_notification.lua", ScriptOutputType.VALUE);
this.workerThreads = new Thread[dedicatedProcessThreadCount];
this.retryExecutor = retryExecutor;
for (int i = 0; i < this.workerThreads.length; i++) {
this.workerThreads[i] = new Thread(new NotificationWorker(workerMaxConcurrency), "PushNotificationScheduler-" + i);
@@ -226,31 +206,6 @@ public class PushNotificationScheduler implements Managed {
.thenRun(Util.NOOP);
}
/**
* Schedules a "new message" push notification to be delivered to the given device after at least the given duration.
* If another notification had previously been scheduled, calling this method will replace the previously-scheduled
* delivery time with the given time.
*
* @param account the account to which the target device belongs
* @param device the device to which to deliver a "new message" push notification
* @param minDelay the minimum delay after which to deliver the notification
*
* @return a future that completes once the notification has been scheduled
*/
public CompletableFuture<Void> scheduleDelayedNotification(final Account account, final Device device, final Duration minDelay) {
final long deliveryTime = clock.instant().plus(minDelay).toEpochMilli();
return ResilienceUtil.getGeneralRedisRetry(RETRY_NAME)
.executeCompletionStage(retryExecutor, () -> pushSchedulingCluster.withCluster(connection ->
connection.async().zadd(getDelayedNotificationQueueKey(account, device),
deliveryTime,
encodeAciAndDeviceId(account, device)))
.thenRun(() -> Metrics.counter(DELAYED_NOTIFICATION_SCHEDULED_COUNTER_NAME,
TOKEN_TYPE_TAG, getTokenType(device))
.increment()))
.toCompletableFuture();
}
/**
* Cancel scheduled notifications for the given account and device.
*
@@ -259,8 +214,7 @@ public class PushNotificationScheduler implements Managed {
public CompletionStage<Void> cancelScheduledNotifications(Account account, Device device) {
return CompletableFuture.allOf(
cancelBackgroundNotifications(PushNotification.TokenType.FCM, account, device),
cancelBackgroundNotifications(PushNotification.TokenType.APN, account, device),
cancelDelayedNotifications(account, device));
cancelBackgroundNotifications(PushNotification.TokenType.APN, account, device));
}
@VisibleForTesting
@@ -271,15 +225,6 @@ public class PushNotificationScheduler implements Managed {
.toCompletableFuture();
}
@VisibleForTesting
CompletableFuture<Void> cancelDelayedNotifications(final Account account, final Device device) {
return pushSchedulingCluster.withCluster(connection ->
connection.async().zrem(getDelayedNotificationQueueKey(account, device),
encodeAciAndDeviceId(account, device)))
.thenRun(Util.NOOP)
.toCompletableFuture();
}
@Override
public synchronized void start() {
running.set(true);
@@ -322,32 +267,6 @@ public class PushNotificationScheduler implements Managed {
.toCompletableFuture();
}
@VisibleForTesting
CompletableFuture<Void> sendDelayedNotification(final Account account, final Device device) {
if (StringUtils.isAllBlank(device.getApnId(), device.getGcmId())) {
return CompletableFuture.completedFuture(null);
}
final boolean isApnsDevice = StringUtils.isNotBlank(device.getApnId());
final PushNotification pushNotification = new PushNotification(
isApnsDevice ? device.getApnId() : device.getGcmId(),
isApnsDevice ? PushNotification.TokenType.APN : PushNotification.TokenType.FCM,
PushNotification.NotificationType.NOTIFICATION,
null,
account,
device,
true, null);
final PushNotificationSender pushNotificationSender = isApnsDevice ? apnSender : fcmSender;
return pushNotificationSender.sendNotification(pushNotification)
.thenAccept(response -> Metrics.counter(DELAYED_NOTIFICATION_SENT_COUNTER_NAME,
TOKEN_TYPE_TAG, getTokenType(device),
ACCEPTED_TAG, String.valueOf(response.accepted()))
.increment());
}
@VisibleForTesting
static String encodeAciAndDeviceId(final Account account, final Device device) {
// Note: This does not include a device registration id. If a device is unlinked and a new device is linked with
@@ -400,15 +319,6 @@ public class PushNotificationScheduler implements Managed {
return LAST_BACKGROUND_NOTIFICATION_TIMESTAMP_KEY_PREFIX + "::{" + encodeAciAndDeviceId(account, device) + "}";
}
@VisibleForTesting
static String getDelayedNotificationQueueKey(final Account account, final Device device) {
return getDelayedNotificationQueueKey(SlotHash.getSlot(encodeAciAndDeviceId(account, device)));
}
private static String getDelayedNotificationQueueKey(final int slot) {
return PENDING_DELAYED_NOTIFICATIONS_KEY_PREFIX + "::{" + RedisClusterUtil.getMinimalHashTag(slot) + "}";
}
@VisibleForTesting
Optional<Instant> getLastBackgroundApnsNotificationTimestamp(final Account account, final Device device) {
return Optional.ofNullable(
@@ -426,25 +336,6 @@ public class PushNotificationScheduler implements Managed {
.map(timestamp -> Instant.ofEpochMilli(timestamp.longValue()));
}
@VisibleForTesting
Optional<Instant> getNextScheduledDelayedNotificationTimestamp(final Account account, final Device device) {
return Optional.ofNullable(
pushSchedulingCluster.withCluster(connection ->
connection.sync().zscore(getDelayedNotificationQueueKey(account, device),
encodeAciAndDeviceId(account, device))))
.map(timestamp -> Instant.ofEpochMilli(timestamp.longValue()));
}
private static String getTokenType(final Device device) {
if (StringUtils.isNotBlank(device.getApnId())) {
return "apns";
} else if (StringUtils.isNotBlank(device.getGcmId())) {
return "fcm";
} else {
return "unknown";
}
}
private static String getPushToken(final PushNotification.TokenType tokenType, final Device device) {
return switch (tokenType) {
case FCM -> device.getGcmId();
@@ -70,13 +70,11 @@ public class AuthenticatedConnectListener implements WebSocketConnectListener {
messagesManager,
messageMetrics,
pushNotificationManager,
pushNotificationScheduler,
account,
device,
client,
messageDeliveryScheduler,
clientReleaseManager,
experimentEnrollmentManager)
clientReleaseManager)
);
}
@@ -13,7 +13,6 @@ import io.micrometer.core.instrument.Metrics;
import io.micrometer.core.instrument.Tag;
import io.micrometer.core.instrument.Tags;
import io.micrometer.core.instrument.Timer;
import java.time.Duration;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
@@ -27,14 +26,13 @@ import org.eclipse.jetty.util.ConstantThrowable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.whispersystems.textsecuregcm.entities.MessageProtos.Envelope;
import org.whispersystems.textsecuregcm.experiment.ExperimentEnrollmentManager;
import org.whispersystems.textsecuregcm.identity.AciServiceIdentifier;
import org.whispersystems.textsecuregcm.identity.ServiceIdentifier;
import org.whispersystems.textsecuregcm.metrics.MessageMetrics;
import org.whispersystems.textsecuregcm.metrics.MetricsUtil;
import org.whispersystems.textsecuregcm.metrics.UserAgentTagUtil;
import org.whispersystems.textsecuregcm.push.NotPushRegisteredException;
import org.whispersystems.textsecuregcm.push.PushNotificationManager;
import org.whispersystems.textsecuregcm.push.PushNotificationScheduler;
import org.whispersystems.textsecuregcm.push.ReceiptSender;
import org.whispersystems.textsecuregcm.storage.Account;
import org.whispersystems.textsecuregcm.storage.ClientReleaseManager;
@@ -79,8 +77,6 @@ public class WebSocketConnection {
@VisibleForTesting
static final int MESSAGE_SENDER_MAX_CONCURRENCY = 256;
private static final Duration CLOSE_WITH_PENDING_MESSAGES_NOTIFICATION_DELAY = Duration.ofMinutes(1);
private static final Logger logger = LoggerFactory.getLogger(WebSocketConnection.class);
private static final Logger droppedErrorLogger = LoggerFactory.getLogger("droppedError");
@@ -88,8 +84,6 @@ public class WebSocketConnection {
private final MessagesManager messagesManager;
private final MessageMetrics messageMetrics;
private final PushNotificationManager pushNotificationManager;
private final PushNotificationScheduler pushNotificationScheduler;
private final ExperimentEnrollmentManager experimentEnrollmentManager;
private final Account authenticatedAccount;
private final Device authenticatedDevice;
@@ -109,25 +103,21 @@ public class WebSocketConnection {
final MessagesManager messagesManager,
final MessageMetrics messageMetrics,
final PushNotificationManager pushNotificationManager,
final PushNotificationScheduler pushNotificationScheduler,
final Account authenticatedAccount,
final Device authenticatedDevice,
final WebSocketClient client,
final Scheduler messageDeliveryScheduler,
final ClientReleaseManager clientReleaseManager,
final ExperimentEnrollmentManager experimentEnrollmentManager) {
final ClientReleaseManager clientReleaseManager) {
this.receiptSender = receiptSender;
this.messagesManager = messagesManager;
this.messageMetrics = messageMetrics;
this.pushNotificationManager = pushNotificationManager;
this.pushNotificationScheduler = pushNotificationScheduler;
this.authenticatedAccount = authenticatedAccount;
this.authenticatedDevice = authenticatedDevice;
this.client = client;
this.messageDeliveryScheduler = messageDeliveryScheduler;
this.clientReleaseManager = clientReleaseManager;
this.experimentEnrollmentManager = experimentEnrollmentManager;
this.messageStream =
messagesManager.getMessages(authenticatedAccount.getAccountIdentifier(), authenticatedDevice);
@@ -194,9 +184,10 @@ public class WebSocketConnection {
messagesManager.mayHaveMessages(authenticatedAccount.getAccountIdentifier(), authenticatedDevice)
.thenAccept(mayHaveMessages -> {
if (mayHaveMessages) {
pushNotificationScheduler.scheduleDelayedNotification(authenticatedAccount,
authenticatedDevice,
CLOSE_WITH_PENDING_MESSAGES_NOTIFICATION_DELAY);
try {
pushNotificationManager.sendNewMessageNotification(authenticatedAccount, authenticatedDevice.getId(), true);
} catch (NotPushRegisteredException _) {
}
}
});
}
@@ -446,7 +446,7 @@ public record CommandDependencies(
APNSender apnSender = new APNSender(apnSenderExecutor, Clock.systemUTC(), configuration.getApnConfiguration());
FcmSender fcmSender = new FcmSender(fcmSenderExecutor, configuration.getFcmConfiguration().credentials().value());
PushNotificationScheduler pushNotificationScheduler = new PushNotificationScheduler(pushSchedulerCluster,
apnSender, fcmSender, accountsManager, 0, 0, retryExecutor);
apnSender, fcmSender, accountsManager, 0, 0);
PushNotificationManager pushNotificationManager = new PushNotificationManager(accountsManager,
apnSender, fcmSender, pushNotificationScheduler);
@@ -90,8 +90,7 @@ public class ScheduledApnPushNotificationSenderServiceCommand extends ServerComm
deps.fcmSender(),
deps.accountsManager(),
namespace.getInt(WORKER_COUNT),
namespace.getInt(MAX_CONCURRENCY),
retryExecutor
namespace.getInt(MAX_CONCURRENCY)
);
environment.lifecycle().manage(pushNotificationScheduler);
@@ -95,6 +95,12 @@ message GetMessagesResponse {
// to deliver newly arrived messages.
google.protobuf.Empty queue_empty = 2;
}
// The time, in milliseconds since the Unix epoch, at which this response
// was sent, according to the server's clock. This can be helpful for detecting
// clock drift between the client and server, which can be important for
// time-sensitive messages.
uint64 server_time_epoch_millis = 3;
}
// Provides methods for sending "sealed sender" messages.
@@ -47,12 +47,13 @@ import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.CsvSource;
import org.signal.chat.messages.GetMessagesResponse;
import org.whispersystems.textsecuregcm.auth.DisconnectionRequestManager;
import org.whispersystems.textsecuregcm.configuration.BulkheadConfiguration;
import org.whispersystems.textsecuregcm.configuration.CircuitBreakerConfiguration;
import org.whispersystems.textsecuregcm.configuration.dynamic.DynamicConfiguration;
import org.whispersystems.textsecuregcm.entities.MessageProtos.Envelope;
import org.whispersystems.textsecuregcm.identity.AciServiceIdentifier;
import org.whispersystems.textsecuregcm.metrics.MessageMetrics;
import org.whispersystems.textsecuregcm.push.PushNotificationManager;
import org.whispersystems.textsecuregcm.push.PushNotificationScheduler;
import org.whispersystems.textsecuregcm.push.ReceiptSender;
import org.whispersystems.textsecuregcm.redis.RedisServerExtension;
import org.whispersystems.textsecuregcm.storage.Account;
@@ -82,7 +83,14 @@ class MessageDispatcherIntegrationTest {
static final DynamoDbExtension DYNAMO_DB_EXTENSION = new DynamoDbExtension(Tables.MESSAGES);
@RegisterExtension
static FoundationDbClusterExtension FOUNDATION_DB_EXTENSION = new FoundationDbClusterExtension(1);
static final FoundationDbClusterExtension FOUNDATION_DB_EXTENSION;
static {
final BulkheadConfiguration bulkheadConfiguration = new BulkheadConfiguration();
bulkheadConfiguration.setMaxConcurrentCalls(256);
FOUNDATION_DB_EXTENSION = new FoundationDbClusterExtension(1, new CircuitBreakerConfiguration(), bulkheadConfiguration);
}
@RegisterExtension
static final RedisServerExtension REDIS_EXTENSION = RedisServerExtension.builder().build();
@@ -151,9 +159,9 @@ class MessageDispatcherIntegrationTest {
sharedExecutorService, Clock.systemUTC()),
new MessageMetrics(),
mock(PushNotificationManager.class),
mock(PushNotificationScheduler.class),
disconnectionRequestManager,
mock(ClientReleaseManager.class));
mock(ClientReleaseManager.class),
Clock.systemUTC());
}
@AfterEach
@@ -20,7 +20,9 @@ import com.google.protobuf.ByteString;
import com.google.protobuf.Empty;
import io.grpc.Status;
import java.nio.charset.StandardCharsets;
import java.time.Clock;
import java.time.Duration;
import java.time.Instant;
import java.util.Arrays;
import java.util.List;
import java.util.UUID;
@@ -38,9 +40,9 @@ import org.whispersystems.textsecuregcm.auth.DisconnectionRequestManager;
import org.whispersystems.textsecuregcm.entities.MessageProtos;
import org.whispersystems.textsecuregcm.entities.MessageProtos.Envelope;
import org.whispersystems.textsecuregcm.identity.AciServiceIdentifier;
import org.whispersystems.textsecuregcm.identity.IdentityType;
import org.whispersystems.textsecuregcm.identity.ServiceIdentifier;
import org.whispersystems.textsecuregcm.metrics.MessageMetrics;
import org.whispersystems.textsecuregcm.push.NotPushRegisteredException;
import org.whispersystems.textsecuregcm.push.PushNotificationManager;
import org.whispersystems.textsecuregcm.push.PushNotificationScheduler;
import org.whispersystems.textsecuregcm.push.ReceiptSender;
@@ -51,6 +53,7 @@ import org.whispersystems.textsecuregcm.storage.Device;
import org.whispersystems.textsecuregcm.storage.MessageStream;
import org.whispersystems.textsecuregcm.storage.MessageStreamEntry;
import org.whispersystems.textsecuregcm.storage.MessagesManager;
import org.whispersystems.textsecuregcm.util.TestClock;
import org.whispersystems.textsecuregcm.util.UUIDUtil;
import reactor.adapter.JdkFlowAdapter;
import reactor.core.publisher.Flux;
@@ -59,13 +62,13 @@ import reactor.test.publisher.TestPublisher;
class MessageDispatcherTest {
private static final GetMessagesResponse QUEUE_EMPTY =
GetMessagesResponse.newBuilder().setQueueEmpty(Empty.getDefaultInstance()).build();
private static final UUID ACI = UUID.randomUUID();
private static final byte DEVICE_ID = 2;
private static final int SOURCE_DEVICE_ID = 1;
private static final String TEST_UA = "test-user-agent";
private static final Clock CLOCK = TestClock.pinned(Instant.now());
private static final GetMessagesResponse QUEUE_EMPTY =
GetMessagesResponse.newBuilder().setQueueEmpty(Empty.getDefaultInstance()).setServerTimeEpochMillis(CLOCK.millis()).build();
private Account account;
private Device device;
@@ -74,7 +77,6 @@ class MessageDispatcherTest {
private PushNotificationManager pushNotificationManager;
private MessageDispatcher dispatcher;
private DisconnectionRequestManager disconnectionRequestManager;
private PushNotificationScheduler pushNotificationScheduler;
@BeforeEach
void setUp() {
@@ -87,7 +89,6 @@ class MessageDispatcherTest {
receiptSender = mock(ReceiptSender.class);
pushNotificationManager = mock(PushNotificationManager.class);
disconnectionRequestManager = mock(DisconnectionRequestManager.class);
pushNotificationScheduler = mock(PushNotificationScheduler.class);
when(device.getId()).thenReturn(DEVICE_ID);
when(device.isPrimary()).thenReturn(true);
@@ -97,14 +98,14 @@ class MessageDispatcherTest {
messagesManager,
new MessageMetrics(),
pushNotificationManager,
pushNotificationScheduler,
disconnectionRequestManager,
mock(ClientReleaseManager.class));
mock(ClientReleaseManager.class),
CLOCK);
}
@ParameterizedTest
@ValueSource(booleans = {false, true})
void drainSingleMessage(final boolean mayHaveMoreMessages) {
void drainSingleMessage(final boolean mayHaveMoreMessages) throws NotPushRegisteredException {
final ServiceIdentifier sourceServiceId = new AciServiceIdentifier(UUID.randomUUID());
final long timestamp = 17;
@@ -119,7 +120,7 @@ class MessageDispatcherTest {
CompletableFuture.completedFuture(mayHaveMoreMessages));
StepVerifier.create(responses)
.expectNext(GetMessagesResponse.newBuilder().setEnvelope(expectedEnvelope).build())
.expectNext(GetMessagesResponse.newBuilder().setEnvelope(expectedEnvelope).setServerTimeEpochMillis(CLOCK.millis()).build())
.then(() -> verify(disconnectionRequestManager).addListener(eq(ACI), eq(DEVICE_ID), any()))
.thenCancel()
.verify(Duration.ofSeconds(5));
@@ -127,8 +128,9 @@ class MessageDispatcherTest {
verify(disconnectionRequestManager).removeListener(eq(ACI), eq(DEVICE_ID), any());
verify(pushNotificationManager).handleMessagesRetrieved(account, device, TEST_UA);
verify(messagesManager).mayHaveMessages(ACI, device);
verify(pushNotificationScheduler, times(mayHaveMoreMessages ? 1 : 0))
.scheduleDelayedNotification(account, device, MessageDispatcher.CLOSE_WITH_PENDING_MESSAGES_NOTIFICATION_DELAY);
verify(pushNotificationManager, times(mayHaveMoreMessages ? 1 : 0))
.sendNewMessageNotification(account, device.getId(), true);
verifyNoInteractions(receiptSender);
}
@@ -144,7 +146,7 @@ class MessageDispatcherTest {
final List<Long> timestamps = messages.stream().map(Envelope::getServerTimestamp).toList();
final List<GetMessagesResponse> expectedMessages = messages.stream()
.map(e -> e.toBuilder().clearEphemeral().build())
.map(e -> GetMessagesResponse.newBuilder().setEnvelope(e).build())
.map(e -> GetMessagesResponse.newBuilder().setEnvelope(e).setServerTimeEpochMillis(CLOCK.millis()).build())
.toList();
final MessageStream messageStream = mockMessages(messages);
@@ -195,7 +197,7 @@ class MessageDispatcherTest {
.toList();
final List<GetMessagesResponse> expectedMessages = messages.stream()
.map(e -> e.toBuilder().clearEphemeral().build())
.map(e -> GetMessagesResponse.newBuilder().setEnvelope(e).build())
.map(e -> GetMessagesResponse.newBuilder().setEnvelope(e).setServerTimeEpochMillis(CLOCK.millis()).build())
.toList();
mockMessages(messages);
@@ -277,7 +279,7 @@ class MessageDispatcherTest {
dispatcher.getMessages(true, TEST_UA, account, device, Flux.never());
ArgumentCaptor<DisconnectionRequestListener> listener = ArgumentCaptor.forClass(DisconnectionRequestListener.class);
StepVerifier.create(responses)
.expectNext(GetMessagesResponse.newBuilder().setEnvelope(expectedEnvelope).build())
.expectNext(GetMessagesResponse.newBuilder().setEnvelope(expectedEnvelope).setServerTimeEpochMillis(CLOCK.millis()).build())
.then(() -> {
verify(disconnectionRequestManager).addListener(eq(ACI), eq(DEVICE_ID), listener.capture());
listener.getValue().handleDisconnectionRequest();
@@ -6,11 +6,14 @@ package org.whispersystems.textsecuregcm.grpc.net;
import static org.junit.jupiter.api.Assertions.assertEquals;
import io.netty.util.test.LeakPresenceExtension;
import java.util.Optional;
import javax.annotation.Nullable;
import org.junit.jupiter.api.extension.ExtendWith;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.CsvSource;
@ExtendWith(LeakPresenceExtension.class)
class BoringSslServerKeyManagerTest {
@ParameterizedTest
@@ -30,6 +30,8 @@ import io.netty.handler.ssl.util.InsecureTrustManagerFactory;
import io.netty.pkitesting.CertificateBuilder;
import io.netty.pkitesting.X509Bundle;
import io.netty.util.Mapping;
import io.netty.util.ReferenceCountUtil;
import io.netty.util.test.LeakPresenceExtension;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.security.KeyStore;
@@ -53,11 +55,13 @@ import org.apache.commons.lang3.RandomStringUtils;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.extension.ExtendWith;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.EnumSource;
import org.junit.jupiter.params.provider.MethodSource;
@ExtendWith(LeakPresenceExtension.class)
class SniMapperTest {
// Configuration for precomputed keystore blob defined in sni-mapper-test-keystore.p12
@@ -139,6 +143,10 @@ class SniMapperTest {
@AfterAll
static void tearDownAfterAll() throws InterruptedException {
eventLoopGroup.shutdownGracefully(1, 1000, TimeUnit.MILLISECONDS).sync();
sniMappingsByProvider.values().forEach(sniMapping -> {
ReferenceCountUtil.release(sniMapping.map(FOO_DOMAIN));
ReferenceCountUtil.release(sniMapping.map(BAR_DOMAIN));
});
}
@ParameterizedTest
@@ -33,6 +33,8 @@ import io.netty.handler.ssl.util.InsecureTrustManagerFactory;
import io.netty.pkitesting.CertificateBuilder;
import io.netty.pkitesting.X509Bundle;
import io.netty.util.Mapping;
import io.netty.util.ReferenceCountUtil;
import io.netty.util.test.LeakPresenceExtension;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.security.KeyStore;
@@ -51,9 +53,11 @@ import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.extension.ExtendWith;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.EnumSource;
@ExtendWith(LeakPresenceExtension.class)
class TlsHandshakeMetricsHandlerTest {
private static final String DOMAIN = "example.org";
@@ -64,6 +68,7 @@ class TlsHandshakeMetricsHandlerTest {
private SimpleMeterRegistry meterRegistry;
private SslContext clientSslContext;
private Mapping<String, SslContext> sniMapping;
private Channel serverChannel;
/// Completed by the server once the handshake event has passed the metrics handler
@@ -108,6 +113,9 @@ class TlsHandshakeMetricsHandlerTest {
if (serverChannel != null) {
serverChannel.close().sync();
}
if (sniMapping != null) {
ReferenceCountUtil.release(sniMapping.map(DOMAIN));
}
}
@AfterAll
@@ -118,7 +126,8 @@ class TlsHandshakeMetricsHandlerTest {
@ParameterizedTest
@EnumSource(value = SslProvider.class, names = {"JDK", "OPENSSL"})
void handshake(final SslProvider sslProvider) throws Exception {
final AtomicReference<Channel> lastServerChildChannel = startServer(buildSniMapping(sslProvider));
sniMapping = buildSniMapping(sslProvider);
final AtomicReference<Channel> lastServerChildChannel = startServer(sniMapping);
connect(null);
assertEquals(1, getCount(true));
@@ -130,7 +139,8 @@ class TlsHandshakeMetricsHandlerTest {
@ParameterizedTest
@EnumSource(value = SslProvider.class, names = {"JDK", "OPENSSL"})
void failedHandshake(final SslProvider sslProvider) throws Exception {
startServer(buildSniMapping(sslProvider));
sniMapping = buildSniMapping(sslProvider);
startServer(sniMapping);
// The server only holds an Ed25519 key
connect(new String[] { "rsa_pss_rsae_sha256" });
@@ -16,17 +16,14 @@ import static org.mockito.Mockito.verifyNoInteractions;
import static org.mockito.Mockito.when;
import io.lettuce.core.cluster.SlotHash;
import java.time.Duration;
import java.time.Instant;
import java.time.temporal.ChronoUnit;
import java.util.Optional;
import java.util.UUID;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ScheduledExecutorService;
import org.apache.commons.lang3.RandomStringUtils;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.CsvSource;
@@ -89,7 +86,7 @@ class PushNotificationSchedulerTest {
.thenReturn(CompletableFuture.completedFuture(new SendPushNotificationResult(true, Optional.empty(), false, Optional.empty())));
pushNotificationScheduler = new PushNotificationScheduler(REDIS_CLUSTER_EXTENSION.getRedisCluster(),
apnSender, fcmSender, accountsManager, clock, 1, 1, mock(ScheduledExecutorService.class));
apnSender, fcmSender, accountsManager, clock, 1, 1);
}
@ParameterizedTest
@@ -207,51 +204,6 @@ class PushNotificationSchedulerTest {
verify(apnSender, never()).sendNotification(any());
}
@Test
void testScheduleDelayedNotification() {
clock.pin(Instant.now());
assertEquals(Optional.empty(),
pushNotificationScheduler.getNextScheduledDelayedNotificationTimestamp(account, device));
pushNotificationScheduler.scheduleDelayedNotification(account, device, Duration.ofMinutes(1)).join();
assertEquals(Optional.of(clock.instant().truncatedTo(ChronoUnit.MILLIS).plus(Duration.ofMinutes(1))),
pushNotificationScheduler.getNextScheduledDelayedNotificationTimestamp(account, device));
pushNotificationScheduler.scheduleDelayedNotification(account, device, Duration.ofMinutes(2)).join();
assertEquals(Optional.of(clock.instant().truncatedTo(ChronoUnit.MILLIS).plus(Duration.ofMinutes(2))),
pushNotificationScheduler.getNextScheduledDelayedNotificationTimestamp(account, device));
}
@Test
void testCancelDelayedNotification() {
pushNotificationScheduler.scheduleDelayedNotification(account, device, Duration.ofMinutes(1)).join();
pushNotificationScheduler.cancelDelayedNotifications(account, device).join();
assertEquals(Optional.empty(),
pushNotificationScheduler.getNextScheduledDelayedNotificationTimestamp(account, device));
}
@Test
void testProcessScheduledDelayedNotifications() {
final PushNotificationScheduler.NotificationWorker worker = pushNotificationScheduler.new NotificationWorker(1);
final int slot = SlotHash.getSlot(PushNotificationScheduler.getDelayedNotificationQueueKey(account, device));
clock.pin(Instant.now());
pushNotificationScheduler.scheduleDelayedNotification(account, device, Duration.ofMinutes(1)).join();
assertEquals(0, worker.processScheduledDelayedNotifications(slot));
clock.pin(clock.instant().plus(Duration.ofMinutes(1)));
assertEquals(1, worker.processScheduledDelayedNotifications(slot));
assertEquals(Optional.empty(),
pushNotificationScheduler.getNextScheduledDelayedNotificationTimestamp(account, device));
}
@ParameterizedTest
@CsvSource({
"1, true",
@@ -266,7 +218,7 @@ class PushNotificationSchedulerTest {
final AccountsManager accountsManager = mock(AccountsManager.class);
pushNotificationScheduler = new PushNotificationScheduler(redisCluster, apnSender, fcmSender,
accountsManager, dedicatedThreadCount, 1, mock(ScheduledExecutorService.class));
accountsManager, dedicatedThreadCount, 1);
pushNotificationScheduler.start();
pushNotificationScheduler.stop();
@@ -48,7 +48,8 @@ public class FoundationDbClusterExtension implements AutoCloseable, BeforeAllCal
@Override
public void beforeAll(final ExtensionContext context) throws IOException {
final String resilienceConfigurationName = "foundationdb-test-" + RandomStringUtils.insecure().nextAlphanumeric(6);
final String resilienceSuffix = RandomStringUtils.insecure().nextAlphanumeric(6);
final String resilienceConfigurationName = "foundationdb-test-" + resilienceSuffix;
ResilienceUtil.getCircuitBreakerRegistry().addConfiguration(resilienceConfigurationName,
circuitBreakerConfiguration.toCircuitBreakerConfig());
@@ -61,11 +62,15 @@ public class FoundationDbClusterExtension implements AutoCloseable, BeforeAllCal
for (int i = 0; i < databaseLifecycleManagers.length; i++) {
final FoundationDbDatabaseLifecycleManager databaseLifecycleManager = serviceContainerNamePrefix != null
? new ServiceContainerFoundationDbDatabaseLifecycleManager(serviceContainerNamePrefix + i)
: new TestcontainersFoundationDbDatabaseLifecycleManager();
? new ServiceContainerFoundationDbDatabaseLifecycleManager(serviceContainerNamePrefix + i)
: new TestcontainersFoundationDbDatabaseLifecycleManager();
databaseLifecycleManager.initializeDatabase(FDB.selectAPIVersion(FoundationDbVersion.getFoundationDbApiVersion()));
databaseLifecycleManagers[i] = databaseLifecycleManager;
databases[i] = new FaultTolerantDatabase(databaseLifecycleManager.getDatabase(), String.format("messages-%d", i), resilienceConfigurationName, resilienceConfigurationName);
// Circuit breakers and bulkheads are cached by name in static registries that outlive individual test
// classes, so use a unique name to make sure this extension's configuration actually takes effect
databases[i] = new FaultTolerantDatabase(databaseLifecycleManager.getDatabase(),
String.format("messages-%d-%s", i, resilienceSuffix), resilienceConfigurationName, resilienceConfigurationName);
}
}
@@ -200,13 +200,11 @@ class WebSocketConnectionIntegrationTest {
new MessagesManager(messagesDynamoDb, foundationDbMessageStore, reportMessageManager, sharedExecutorService, Clock.systemUTC()),
new MessageMetrics(),
mock(PushNotificationManager.class),
mock(PushNotificationScheduler.class),
account,
device,
webSocketClient,
messageDeliveryScheduler,
clientReleaseManager,
mock(ExperimentEnrollmentManager.class)
clientReleaseManager
);
final List<MessageProtos.Envelope> expectedMessages = new ArrayList<>(dynamoDbMessageCount + foundationDbMessageCount);
@@ -285,13 +283,11 @@ class WebSocketConnectionIntegrationTest {
new MessagesManager(messagesDynamoDb, foundationDbMessageStore, reportMessageManager, sharedExecutorService, Clock.systemUTC()),
new MessageMetrics(),
mock(PushNotificationManager.class),
mock(PushNotificationScheduler.class),
account,
device,
webSocketClient,
messageDeliveryScheduler,
clientReleaseManager,
mock(ExperimentEnrollmentManager.class)
clientReleaseManager
);
final int dynamoDbMessageCount = 77;
@@ -406,13 +402,11 @@ class WebSocketConnectionIntegrationTest {
new MessagesManager(messagesDynamoDb, foundationDbMessageStore, reportMessageManager, sharedExecutorService, Clock.systemUTC()),
new MessageMetrics(),
mock(PushNotificationManager.class),
mock(PushNotificationScheduler.class),
account,
device,
webSocketClient,
messageDeliveryScheduler,
clientReleaseManager,
mock(ExperimentEnrollmentManager.class)
clientReleaseManager
);
final int dynamoDBMessageCount = 207;
@@ -493,13 +487,11 @@ class WebSocketConnectionIntegrationTest {
messagesManager,
new MessageMetrics(),
mock(PushNotificationManager.class),
mock(PushNotificationScheduler.class),
account,
device,
webSocketClient,
messageDeliveryScheduler,
clientReleaseManager,
mock(ExperimentEnrollmentManager.class));
clientReleaseManager);
final WebSocketResponseMessage successResponse = mock(WebSocketResponseMessage.class);
when(successResponse.getStatus()).thenReturn(200);
@@ -119,13 +119,11 @@ class WebSocketConnectionTest {
messagesManager,
new MessageMetrics(),
mock(PushNotificationManager.class),
mock(PushNotificationScheduler.class),
account,
device,
client,
Schedulers.immediate(),
clientReleaseManager,
mock(ExperimentEnrollmentManager.class));
clientReleaseManager);
}
@Test