what-the-bank/sources/io/grpc/HttpConnectProxiedSocketAdd...

100 lines
3.7 KiB
Java
Raw Permalink Normal View History

2024-07-27 18:17:47 +07:00
package io.grpc;
import com.google.common.base.MoreObjects;
import com.google.common.base.Objects;
import com.google.common.base.Preconditions;
import java.net.InetSocketAddress;
import java.net.SocketAddress;
/* loaded from: classes6.dex */
public final class HttpConnectProxiedSocketAddress extends ProxiedSocketAddress {
private static final long serialVersionUID = 0;
private final String password;
private final SocketAddress proxyAddress;
private final InetSocketAddress targetAddress;
private final String username;
private HttpConnectProxiedSocketAddress(SocketAddress socketAddress, InetSocketAddress inetSocketAddress, String str, String str2) {
Preconditions.checkNotNull(socketAddress, "proxyAddress");
Preconditions.checkNotNull(inetSocketAddress, "targetAddress");
if (socketAddress instanceof InetSocketAddress) {
Preconditions.checkState(!((InetSocketAddress) socketAddress).isUnresolved(), "The proxy address %s is not resolved", socketAddress);
}
this.proxyAddress = socketAddress;
this.targetAddress = inetSocketAddress;
this.username = str;
this.password = str2;
}
public final boolean equals(Object obj) {
if (!(obj instanceof HttpConnectProxiedSocketAddress)) {
return false;
}
HttpConnectProxiedSocketAddress httpConnectProxiedSocketAddress = (HttpConnectProxiedSocketAddress) obj;
return Objects.equal(this.proxyAddress, httpConnectProxiedSocketAddress.proxyAddress) && Objects.equal(this.targetAddress, httpConnectProxiedSocketAddress.targetAddress) && Objects.equal(this.username, httpConnectProxiedSocketAddress.username) && Objects.equal(this.password, httpConnectProxiedSocketAddress.password);
}
public final int hashCode() {
return Objects.hashCode(this.proxyAddress, this.targetAddress, this.username, this.password);
}
public final String toString() {
return MoreObjects.toStringHelper(this).add("proxyAddr", this.proxyAddress).add("targetAddr", this.targetAddress).add("username", this.username).add("hasPassword", this.password != null).toString();
}
public static Builder newBuilder() {
return new Builder();
}
/* loaded from: classes6.dex */
public static final class Builder {
private String password;
private SocketAddress proxyAddress;
private InetSocketAddress targetAddress;
private String username;
private Builder() {
}
public final Builder setProxyAddress(SocketAddress socketAddress) {
this.proxyAddress = (SocketAddress) Preconditions.checkNotNull(socketAddress, "proxyAddress");
return this;
}
public final Builder setTargetAddress(InetSocketAddress inetSocketAddress) {
this.targetAddress = (InetSocketAddress) Preconditions.checkNotNull(inetSocketAddress, "targetAddress");
return this;
}
public final HttpConnectProxiedSocketAddress build() {
return new HttpConnectProxiedSocketAddress(this.proxyAddress, this.targetAddress, this.username, this.password);
}
public final Builder setUsername(String str) {
this.username = str;
return this;
}
public final Builder setPassword(String str) {
this.password = str;
return this;
}
}
public final String getUsername() {
return this.username;
}
public final InetSocketAddress getTargetAddress() {
return this.targetAddress;
}
public final SocketAddress getProxyAddress() {
return this.proxyAddress;
}
public final String getPassword() {
return this.password;
}
}