mirror of
https://github.com/signalapp/Signal-Server.git
synced 2026-11-30 00:56:50 +00:00
Address various deprecations
This commit is contained in:
1 parent
cb02200a24
commit
ce3378354d
4 files changed
+12
-15
No files matched your search
+2
-3
@@ -25,13 +25,12 @@ import java.util.concurrent.atomic.AtomicReference;
|
|||||||
import java.util.concurrent.atomic.LongAdder;
|
import java.util.concurrent.atomic.LongAdder;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.eclipse.jetty.util.StaticException;
|
import org.eclipse.jetty.util.ConstantThrowable;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.whispersystems.textsecuregcm.entities.MessageProtos.Envelope;
|
import org.whispersystems.textsecuregcm.entities.MessageProtos.Envelope;
|
||||||
import org.whispersystems.textsecuregcm.experiment.ExperimentEnrollmentManager;
|
import org.whispersystems.textsecuregcm.experiment.ExperimentEnrollmentManager;
|
||||||
import org.whispersystems.textsecuregcm.identity.AciServiceIdentifier;
|
import org.whispersystems.textsecuregcm.identity.AciServiceIdentifier;
|
||||||
import org.whispersystems.textsecuregcm.identity.IdentityType;
|
|
||||||
import org.whispersystems.textsecuregcm.identity.ServiceIdentifier;
|
import org.whispersystems.textsecuregcm.identity.ServiceIdentifier;
|
||||||
import org.whispersystems.textsecuregcm.limits.MessageDeliveryLoopMonitor;
|
import org.whispersystems.textsecuregcm.limits.MessageDeliveryLoopMonitor;
|
||||||
import org.whispersystems.textsecuregcm.metrics.MessageMetrics;
|
import org.whispersystems.textsecuregcm.metrics.MessageMetrics;
|
||||||
@@ -329,6 +328,6 @@ public class WebSocketConnection {
|
|||||||
return throwable instanceof java.nio.channels.ClosedChannelException ||
|
return throwable instanceof java.nio.channels.ClosedChannelException ||
|
||||||
throwable == WebSocketResourceProvider.CONNECTION_CLOSED_EXCEPTION ||
|
throwable == WebSocketResourceProvider.CONNECTION_CLOSED_EXCEPTION ||
|
||||||
throwable instanceof org.eclipse.jetty.io.EofException ||
|
throwable instanceof org.eclipse.jetty.io.EofException ||
|
||||||
(throwable instanceof StaticException staticException && "Closed".equals(staticException.getMessage()));
|
(throwable instanceof ConstantThrowable constantThrowable && "Closed".equals(constantThrowable.getMessage()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+6
-8
@@ -130,10 +130,9 @@ public class ProvisioningTimeoutIntegrationTest {
|
|||||||
when(testApplication.scheduler.schedule(any(Runnable.class), anyLong(), any()))
|
when(testApplication.scheduler.schedule(any(Runnable.class), anyLong(), any()))
|
||||||
.thenReturn(mock(ScheduledFuture.class));
|
.thenReturn(mock(ScheduledFuture.class));
|
||||||
|
|
||||||
final ClientUpgradeRequest upgradeRequest = new ClientUpgradeRequest();
|
final ClientUpgradeRequest upgradeRequest = new ClientUpgradeRequest(
|
||||||
try (Session ignored = client.connect(testWebsocketListener,
|
URI.create(String.format("ws://127.0.0.1:%d/websocket", DROPWIZARD_APP_EXTENSION.getLocalPort())));
|
||||||
URI.create(String.format("ws://127.0.0.1:%d/websocket", DROPWIZARD_APP_EXTENSION.getLocalPort())),
|
try (Session ignored = client.connect(testWebsocketListener, upgradeRequest).join()) {
|
||||||
upgradeRequest).join()) {
|
|
||||||
|
|
||||||
assertThat(testWebsocketListener.provisioningAddressFuture.join()).isNotNull();
|
assertThat(testWebsocketListener.provisioningAddressFuture.join()).isNotNull();
|
||||||
assertThat(testWebsocketListener.closeFuture()).isNotDone();
|
assertThat(testWebsocketListener.closeFuture()).isNotDone();
|
||||||
@@ -156,10 +155,9 @@ public class ProvisioningTimeoutIntegrationTest {
|
|||||||
@SuppressWarnings("unchecked") final ScheduledFuture<Void> scheduled = mock(ScheduledFuture.class);
|
@SuppressWarnings("unchecked") final ScheduledFuture<Void> scheduled = mock(ScheduledFuture.class);
|
||||||
doReturn(scheduled).when(testApplication.scheduler).schedule(any(Runnable.class), anyLong(), any());
|
doReturn(scheduled).when(testApplication.scheduler).schedule(any(Runnable.class), anyLong(), any());
|
||||||
|
|
||||||
final ClientUpgradeRequest upgradeRequest = new ClientUpgradeRequest();
|
final ClientUpgradeRequest upgradeRequest = new ClientUpgradeRequest(
|
||||||
final Session session = client.connect(testWebsocketListener,
|
URI.create(String.format("ws://127.0.0.1:%d/websocket", DROPWIZARD_APP_EXTENSION.getLocalPort())));
|
||||||
URI.create(String.format("ws://127.0.0.1:%d/websocket", DROPWIZARD_APP_EXTENSION.getLocalPort())),
|
final Session session = client.connect(testWebsocketListener, upgradeRequest).join();
|
||||||
upgradeRequest).join();
|
|
||||||
|
|
||||||
// Close the websocket, make sure the timeout is cancelled.
|
// Close the websocket, make sure the timeout is cancelled.
|
||||||
session.close();
|
session.close();
|
||||||
|
|||||||
+3
-3
@@ -4,18 +4,17 @@
|
|||||||
*/
|
*/
|
||||||
package org.whispersystems.textsecuregcm.tests.util;
|
package org.whispersystems.textsecuregcm.tests.util;
|
||||||
|
|
||||||
|
import com.google.protobuf.InvalidProtocolBufferException;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.UncheckedIOException;
|
import java.io.UncheckedIOException;
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.concurrent.CopyOnWriteArrayList;
|
||||||
import java.util.concurrent.atomic.AtomicLong;
|
import java.util.concurrent.atomic.AtomicLong;
|
||||||
import com.google.protobuf.InvalidProtocolBufferException;
|
|
||||||
import org.eclipse.jetty.websocket.api.Callback;
|
import org.eclipse.jetty.websocket.api.Callback;
|
||||||
import org.eclipse.jetty.websocket.api.Session;
|
import org.eclipse.jetty.websocket.api.Session;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
@@ -50,8 +49,9 @@ public class TestWebsocketListener implements Session.Listener.AutoDemanding {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onWebSocketClose(int statusCode, String reason) {
|
public void onWebSocketClose(int statusCode, String reason, Callback callback) {
|
||||||
closed.complete(statusCode);
|
closed.complete(statusCode);
|
||||||
|
callback.succeed();
|
||||||
}
|
}
|
||||||
|
|
||||||
public CompletableFuture<Integer> closeFuture() {
|
public CompletableFuture<Integer> closeFuture() {
|
||||||
|
|||||||
+1
-1
@@ -72,7 +72,7 @@ public class WebSocketSessionContext {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public interface WebSocketEventListener {
|
public interface WebSocketEventListener {
|
||||||
public void onWebSocketClose(WebSocketSessionContext context, int statusCode, String reason);
|
void onWebSocketClose(WebSocketSessionContext context, int statusCode, String reason);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user