Exemplo n.º 1
0
  public Bundle getEndpointFingerprint(int id) {
    Bundle data = new Bundle();

    Client client = this.clients.get(id);

    if (client != null)
      data.putString(Endpoint.CONNECTOR_SSL_FINGERPRINT, client.getPeerCertificateFingerprint());
    else data.putString(Endpoint.CONNECTOR_SSL_FINGERPRINT, "No running client.");

    return data;
  }
Exemplo n.º 2
0
  public void stopEndpoint(int id) {
    Endpoint endpoint = this.endpoint_manager.get(id);
    Client client = this.clients.get(id);

    if (client != null) {
      client.stopConnector();
      endpoint.enabled = false;

      this.clients.remove(id);

      Toast.makeText(
              this,
              String.format(
                  Locale.ENGLISH,
                  this.getString(R.string.endpoint_stopped),
                  endpoint.toConnectionString()),
              Toast.LENGTH_SHORT)
          .show();
    }
  }
Exemplo n.º 3
0
  public void startEndpoint(int id) {
    if (this.clients.get(id) == null) {
      Endpoint endpoint = this.endpoint_manager.get(id, true);

      Client client = new Client(endpoint);
      client.setLogger(this);

      this.clients.put(id, client);

      endpoint.enabled = true;
      client.start();

      Toast.makeText(
              this,
              String.format(
                  Locale.ENGLISH,
                  this.getString(R.string.endpoint_started),
                  endpoint.toConnectionString()),
              Toast.LENGTH_SHORT)
          .show();
    }
  }