Add UI support for configuring a proxy.

This commit is contained in:
Greyson Parrelli
2021-02-02 16:42:47 -05:00
committed by GitHub
parent 0d215d609b
commit 46344776a4
37 changed files with 1217 additions and 55 deletions

View File

@@ -9,13 +9,11 @@ import java.net.InetAddress;
import java.net.Socket;
import java.net.SocketAddress;
import java.net.SocketException;
import java.net.SocketOption;
import java.net.UnknownHostException;
import java.nio.channels.SocketChannel;
import java.security.KeyManagementException;
import java.security.NoSuchAlgorithmException;
import java.util.List;
import java.util.Set;
import javax.net.SocketFactory;
import javax.net.ssl.SSLContext;

View File

@@ -1,9 +1,12 @@
package org.whispersystems.signalservice.api.websocket;
import okhttp3.Response;
public interface ConnectivityListener {
void onConnected();
void onConnecting();
void onDisconnected();
void onAuthenticationFailure();
boolean onGenericFailure(Response response, Throwable throwable);
}

View File

@@ -304,7 +304,15 @@ public class WebSocketConnection extends WebSocketListener {
Log.w(TAG, "onFailure()", t);
if (response != null && (response.code() == 401 || response.code() == 403)) {
if (listener != null) listener.onAuthenticationFailure();
if (listener != null) {
listener.onAuthenticationFailure();
}
} else if (listener != null) {
boolean shouldRetryConnection = listener.onGenericFailure(response, t);
if (!shouldRetryConnection) {
Log.w(TAG, "Experienced a failure, and the listener indicated we should not retry the connection. Disconnecting.");
disconnect();
}
}
if (client != null) {