Java源码示例:org.whispersystems.signalservice.api.messages.calls.TurnServerInfo

示例1
private ListenableFutureTask<List<PeerConnection.IceServer>> retrieveTurnServers() {
  Callable<List<PeerConnection.IceServer>> callable = () -> {
    LinkedList<PeerConnection.IceServer> results = new LinkedList<>();

    results.add(new PeerConnection.IceServer("stun:stun1.l.google.com:19302"));
    try {
      TurnServerInfo turnServerInfo = accountManager.getTurnServerInfo();

      for (String url : turnServerInfo.getUrls()) {
        Log.i(TAG, "ice_server: " + url);
        if (url.startsWith("turn")) {
          results.add(new PeerConnection.IceServer(url, turnServerInfo.getUsername(), turnServerInfo.getPassword()));
        } else {
          results.add(new PeerConnection.IceServer(url));
        }
      }
    } catch (IOException e) {
      Log.w(TAG, e);
    }

    return results;
  };

  ListenableFutureTask<List<PeerConnection.IceServer>> futureTask = new ListenableFutureTask<>(callable, null, serviceExecutor);
  networkExecutor.execute(futureTask);

  return futureTask;
}
 
示例2
private ListenableFutureTask<List<PeerConnection.IceServer>> retrieveTurnServers() {
    Callable<List<PeerConnection.IceServer>> callable = () -> {
        LinkedList<PeerConnection.IceServer> results = new LinkedList<>();

        try {
            TurnServerInfo turnServerInfo = ChatHttp.INSTANCE.get(WebRtcCallService.accountContext).getTurnServerInfo();

            for (String url : turnServerInfo.getUrls()) {
                if (url.startsWith("turn")) {
                    results.add(new PeerConnection.IceServer(url, turnServerInfo.getUsername(), turnServerInfo.getPassword()));
                } else {
                    results.add(new PeerConnection.IceServer(url));
                }
            }

        } catch (Exception e) {
            ALog.logForSecret(TAG, "retrieveTurnServers error", e);
        }

        return results;
    };

    ListenableFutureTask<List<PeerConnection.IceServer>> futureTask = new ListenableFutureTask<>(callable, null, serviceExecutor);
    networkExecutor.execute(futureTask);

    return futureTask;
}
 
示例3
public TurnServerInfo getTurnServerInfo() throws IOException {
  return this.pushServiceSocket.getTurnServerInfo();
}
 
示例4
public TurnServerInfo getTurnServerInfo() throws IOException {
  String response = makeServiceRequest(TURN_SERVER_INFO, "GET", null);
  return JsonUtil.fromJson(response, TurnServerInfo.class);
}
 
示例5
public TurnServerInfo getTurnServerInfo() throws IOException {
  return this.pushServiceSocket.getTurnServerInfo();
}
 
示例6
public TurnServerInfo getTurnServerInfo() throws IOException {
  String response = makeServiceRequest(TURN_SERVER_INFO, "GET", null);
  return JsonUtil.fromJson(response, TurnServerInfo.class);
}