Skip to content

Commit

Permalink
updated realtime channel test for resume flag
Browse files Browse the repository at this point in the history
  • Loading branch information
sacOO7 committed Jan 23, 2024
1 parent cfc7cb3 commit 75a8032
Showing 1 changed file with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1479,8 +1479,8 @@ public void channel_server_initiated_attached_detached() throws AblyException {
channel.attach();
channelWaiter.waitFor(ChannelState.attached);

final int[] updateEventsEmitted = new int[]{0};
final boolean[] resumedFlag = new boolean[]{true};
final int[] updateEventsEmitted = {0};
final boolean[] resumedFlag = {false};
channel.on(ChannelEvent.update, new ChannelStateListener() {
@Override
public void onChannelStateChanged(ChannelStateChange stateChange) {
Expand All @@ -1497,19 +1497,19 @@ public void onChannelStateChanged(ChannelStateChange stateChange) {
}};
ably.connection.connectionManager.onMessage(null, attachedMessage);

/* Inject detached message as if from the server */
ProtocolMessage detachedMessage = new ProtocolMessage() {{
action = Action.detached;
channel = channelName;
}};
ably.connection.connectionManager.onMessage(null, detachedMessage);
// /* Inject detached message as if from the server */
// ProtocolMessage detachedMessage = new ProtocolMessage() {{
// action = Action.detached;
// channel = channelName;
// }};
// ably.connection.connectionManager.onMessage(null, detachedMessage);

/* Channel should transition to attaching, then to attached */
channelWaiter.waitFor(ChannelState.attaching);
channelWaiter.waitFor(ChannelState.attached);
// channelWaiter.waitFor(ChannelState.attaching);
// channelWaiter.waitFor(ChannelState.attached);

/* Verify received UPDATE message on channel */
assertEquals("Verify exactly one UPDATE event was emitted on the channel", updateEventsEmitted[0], 1);
assertEquals("Verify exactly one UPDATE event was emitted on the channel",1, updateEventsEmitted[0]);
assertTrue("Verify resumed flag set in UPDATE event", resumedFlag[0]);
} finally {
if (ably != null)
Expand Down

0 comments on commit 75a8032

Please sign in to comment.