org.whispersystems.signalservice.internal.configuration.SignalUrl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of signal-service-java Show documentation
Show all versions of signal-service-java Show documentation
Signal Service communication library for Java
The newest version!
package org.whispersystems.signalservice.internal.configuration;
import org.whispersystems.libsignal.util.guava.Optional;
import org.whispersystems.signalservice.api.push.TrustStore;
import org.whispersystems.signalservice.internal.util.BlacklistingTrustManager;
import java.util.Collections;
import java.util.List;
import javax.net.ssl.TrustManager;
import okhttp3.ConnectionSpec;
public class SignalUrl {
private final String url;
private final Optional hostHeader;
private final Optional connectionSpec;
private TrustStore trustStore;
public SignalUrl(String url, TrustStore trustStore) {
this(url, null, trustStore, null);
}
public SignalUrl(String url, String hostHeader,
TrustStore trustStore,
ConnectionSpec connectionSpec)
{
this.url = url;
this.hostHeader = Optional.fromNullable(hostHeader);
this.trustStore = trustStore;
this.connectionSpec = Optional.fromNullable(connectionSpec);
}
public Optional getHostHeader() {
return hostHeader;
}
public String getUrl() {
return url;
}
public TrustStore getTrustStore() {
return trustStore;
}
public Optional> getConnectionSpecs() {
return connectionSpec.isPresent() ? Optional.of(Collections.singletonList(connectionSpec.get())) : Optional.>absent();
}
}