mirror of https://github.com/grpc/grpc-java.git
core: Allow specifying a ProxyDetector per ManagedChannel
This commit is contained in:
parent
3d2e375aa1
commit
3a38e59bae
|
|
@ -236,6 +236,12 @@ public abstract class ForwardingChannelBuilder<T extends ForwardingChannelBuilde
|
||||||
return thisT();
|
return thisT();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public T proxyDetector(ProxyDetector proxyDetector) {
|
||||||
|
delegate().proxyDetector(proxyDetector);
|
||||||
|
return thisT();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the {@link ManagedChannel} built by the delegate by default. Overriding method can
|
* Returns the {@link ManagedChannel} built by the delegate by default. Overriding method can
|
||||||
* return different value.
|
* return different value.
|
||||||
|
|
|
||||||
|
|
@ -524,6 +524,18 @@ public abstract class ManagedChannelBuilder<T extends ManagedChannelBuilder<T>>
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the proxy detector to be used in addresses name resolution. If <code>null</code> is passed
|
||||||
|
* the default proxy detector will be used.
|
||||||
|
*
|
||||||
|
* @return this
|
||||||
|
* @since 1.19.0
|
||||||
|
*/
|
||||||
|
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/5113")
|
||||||
|
public T proxyDetector(ProxyDetector proxyDetector) {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Builds a channel using the given parameters.
|
* Builds a channel using the given parameters.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -99,6 +99,13 @@ public abstract class NameResolver {
|
||||||
public static final Attributes.Key<Integer> PARAMS_DEFAULT_PORT =
|
public static final Attributes.Key<Integer> PARAMS_DEFAULT_PORT =
|
||||||
Attributes.Key.create("params-default-port");
|
Attributes.Key.create("params-default-port");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Proxy detector used in name resolution.
|
||||||
|
*/
|
||||||
|
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/5113")
|
||||||
|
public static final Attributes.Key<ProxyDetector> PARAMS_PROXY_DETECTOR =
|
||||||
|
Attributes.Key.create("params-proxy-detector");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a {@link NameResolver} for the given target URI, or {@code null} if the given URI
|
* Creates a {@link NameResolver} for the given target URI, or {@code null} if the given URI
|
||||||
* cannot be resolved by this factory. The decision should be solely based on the scheme of the
|
* cannot be resolved by this factory. The decision should be solely based on the scheme of the
|
||||||
|
|
@ -106,7 +113,7 @@ public abstract class NameResolver {
|
||||||
*
|
*
|
||||||
* @param targetUri the target URI to be resolved, whose scheme must not be {@code null}
|
* @param targetUri the target URI to be resolved, whose scheme must not be {@code null}
|
||||||
* @param params optional parameters. Canonical keys are defined as {@code PARAMS_*} fields in
|
* @param params optional parameters. Canonical keys are defined as {@code PARAMS_*} fields in
|
||||||
* {@link Factory}.
|
* {@link Factory}.
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
@Nullable
|
@Nullable
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package io.grpc.internal;
|
package io.grpc;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.SocketAddress;
|
import java.net.SocketAddress;
|
||||||
|
|
@ -26,6 +26,7 @@ import javax.annotation.Nullable;
|
||||||
* and should only be used in places that are expected to do IO such as the
|
* and should only be used in places that are expected to do IO such as the
|
||||||
* {@link io.grpc.NameResolver}.
|
* {@link io.grpc.NameResolver}.
|
||||||
*/
|
*/
|
||||||
|
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/5113")
|
||||||
public interface ProxyDetector {
|
public interface ProxyDetector {
|
||||||
/**
|
/**
|
||||||
* Given a target address, returns which proxy address should be used. If no proxy should be
|
* Given a target address, returns which proxy address should be used. If no proxy should be
|
||||||
|
|
@ -14,35 +14,58 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package io.grpc.internal;
|
package io.grpc;
|
||||||
|
|
||||||
import com.google.common.base.Objects;
|
import com.google.common.base.Objects;
|
||||||
import com.google.common.base.Preconditions;
|
import com.google.common.base.Preconditions;
|
||||||
import java.net.InetSocketAddress;
|
import java.net.InetSocketAddress;
|
||||||
|
import java.net.SocketAddress;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used to express the result of a proxy lookup.
|
* Used to express the result of a proxy lookup.
|
||||||
*/
|
*/
|
||||||
|
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/5113")
|
||||||
public final class ProxyParameters {
|
public final class ProxyParameters {
|
||||||
public final InetSocketAddress proxyAddress;
|
|
||||||
@Nullable public final String username;
|
|
||||||
@Nullable public final String password;
|
|
||||||
|
|
||||||
/** Creates an instance. */
|
private final SocketAddress proxyAddress;
|
||||||
public ProxyParameters(
|
@Nullable
|
||||||
InetSocketAddress proxyAddress,
|
private final String username;
|
||||||
|
@Nullable
|
||||||
|
private final String password;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates an instance.
|
||||||
|
*/
|
||||||
|
private ProxyParameters(
|
||||||
|
SocketAddress proxyAddress,
|
||||||
@Nullable String username,
|
@Nullable String username,
|
||||||
@Nullable String password) {
|
@Nullable String password) {
|
||||||
Preconditions.checkNotNull(proxyAddress);
|
Preconditions.checkNotNull(proxyAddress);
|
||||||
// The resolution must be done by the ProxyParameters producer, because consumers
|
// The resolution must be done by the ProxyParameters producer, because consumers
|
||||||
// may not be allowed to do IO.
|
// may not be allowed to do IO.
|
||||||
Preconditions.checkState(!proxyAddress.isUnresolved());
|
if (proxyAddress instanceof InetSocketAddress) {
|
||||||
|
Preconditions.checkState(!((InetSocketAddress)proxyAddress).isUnresolved());
|
||||||
|
}
|
||||||
this.proxyAddress = proxyAddress;
|
this.proxyAddress = proxyAddress;
|
||||||
this.username = username;
|
this.username = username;
|
||||||
this.password = password;
|
this.password = password;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
public String getPassword() {
|
||||||
|
return password;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
public String getUsername() {
|
||||||
|
return username;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SocketAddress getProxyAddress() {
|
||||||
|
return proxyAddress;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (!(o instanceof ProxyParameters)) {
|
if (!(o instanceof ProxyParameters)) {
|
||||||
|
|
@ -58,4 +81,41 @@ public final class ProxyParameters {
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hashCode(proxyAddress, username, password);
|
return Objects.hashCode(proxyAddress, username, password);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new builder.
|
||||||
|
*/
|
||||||
|
public static Builder forAddress(SocketAddress proxyAddress) {
|
||||||
|
return new Builder(proxyAddress);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The helper class to build an Attributes instance.
|
||||||
|
*/
|
||||||
|
public static final class Builder {
|
||||||
|
|
||||||
|
private final SocketAddress proxyAddress;
|
||||||
|
@Nullable
|
||||||
|
private String username;
|
||||||
|
@Nullable
|
||||||
|
private String password;
|
||||||
|
|
||||||
|
private Builder(SocketAddress proxyAddress) {
|
||||||
|
this.proxyAddress = Preconditions.checkNotNull(proxyAddress, "proxyAddress");
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder username(@Nullable String username) {
|
||||||
|
this.username = username;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder password(@Nullable String password) {
|
||||||
|
this.password = password;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ProxyParameters build() {
|
||||||
|
return new ProxyParameters(this.proxyAddress, this.username, this.password);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -33,6 +33,7 @@ import io.grpc.ManagedChannel;
|
||||||
import io.grpc.ManagedChannelBuilder;
|
import io.grpc.ManagedChannelBuilder;
|
||||||
import io.grpc.NameResolver;
|
import io.grpc.NameResolver;
|
||||||
import io.grpc.NameResolverProvider;
|
import io.grpc.NameResolverProvider;
|
||||||
|
import io.grpc.ProxyDetector;
|
||||||
import io.opencensus.trace.Tracing;
|
import io.opencensus.trace.Tracing;
|
||||||
import java.net.SocketAddress;
|
import java.net.SocketAddress;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
|
|
@ -145,6 +146,9 @@ public abstract class AbstractManagedChannelImplBuilder
|
||||||
@Nullable
|
@Nullable
|
||||||
BinaryLog binlog;
|
BinaryLog binlog;
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
ProxyDetector proxyDetector;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the maximum message size allowed for a single gRPC frame. If an inbound messages
|
* Sets the maximum message size allowed for a single gRPC frame. If an inbound messages
|
||||||
* larger than this limit is received it will not be processed and the RPC will fail with
|
* larger than this limit is received it will not be processed and the RPC will fail with
|
||||||
|
|
@ -369,6 +373,12 @@ public abstract class AbstractManagedChannelImplBuilder
|
||||||
return thisT();
|
return thisT();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public T proxyDetector(@Nullable ProxyDetector proxyDetector) {
|
||||||
|
this.proxyDetector = proxyDetector;
|
||||||
|
return thisT();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Disable or enable stats features. Enabled by default.
|
* Disable or enable stats features. Enabled by default.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ package io.grpc.internal;
|
||||||
import com.google.common.base.Objects;
|
import com.google.common.base.Objects;
|
||||||
import com.google.common.base.Preconditions;
|
import com.google.common.base.Preconditions;
|
||||||
import io.grpc.Attributes;
|
import io.grpc.Attributes;
|
||||||
|
import io.grpc.ProxyParameters;
|
||||||
import java.io.Closeable;
|
import java.io.Closeable;
|
||||||
import java.net.SocketAddress;
|
import java.net.SocketAddress;
|
||||||
import java.util.concurrent.ScheduledExecutorService;
|
import java.util.concurrent.ScheduledExecutorService;
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,8 @@ import com.google.common.base.Verify;
|
||||||
import io.grpc.Attributes;
|
import io.grpc.Attributes;
|
||||||
import io.grpc.EquivalentAddressGroup;
|
import io.grpc.EquivalentAddressGroup;
|
||||||
import io.grpc.NameResolver;
|
import io.grpc.NameResolver;
|
||||||
|
import io.grpc.ProxyDetector;
|
||||||
|
import io.grpc.ProxyParameters;
|
||||||
import io.grpc.Status;
|
import io.grpc.Status;
|
||||||
import io.grpc.internal.SharedResourceHolder.Resource;
|
import io.grpc.internal.SharedResourceHolder.Resource;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
@ -251,7 +253,7 @@ final class DnsNameResolver extends NameResolver {
|
||||||
}
|
}
|
||||||
if (proxy != null) {
|
if (proxy != null) {
|
||||||
if (logger.isLoggable(Level.FINER)) {
|
if (logger.isLoggable(Level.FINER)) {
|
||||||
logger.finer("Using proxy " + proxy.proxyAddress + " for " + resolver.host);
|
logger.finer("Using proxy " + proxy.getProxyAddress() + " for " + resolver.host);
|
||||||
}
|
}
|
||||||
EquivalentAddressGroup server =
|
EquivalentAddressGroup server =
|
||||||
new EquivalentAddressGroup(
|
new EquivalentAddressGroup(
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,9 @@ import com.google.common.base.Preconditions;
|
||||||
import com.google.common.base.Stopwatch;
|
import com.google.common.base.Stopwatch;
|
||||||
import io.grpc.Attributes;
|
import io.grpc.Attributes;
|
||||||
import io.grpc.InternalServiceProviders;
|
import io.grpc.InternalServiceProviders;
|
||||||
|
import io.grpc.NameResolver.Factory;
|
||||||
import io.grpc.NameResolverProvider;
|
import io.grpc.NameResolverProvider;
|
||||||
|
import io.grpc.ProxyDetector;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -49,12 +51,14 @@ public final class DnsNameResolverProvider extends NameResolverProvider {
|
||||||
Preconditions.checkArgument(targetPath.startsWith("/"),
|
Preconditions.checkArgument(targetPath.startsWith("/"),
|
||||||
"the path component (%s) of the target (%s) must start with '/'", targetPath, targetUri);
|
"the path component (%s) of the target (%s) must start with '/'", targetPath, targetUri);
|
||||||
String name = targetPath.substring(1);
|
String name = targetPath.substring(1);
|
||||||
|
ProxyDetector proxyDetector = Preconditions
|
||||||
|
.checkNotNull(params.get(Factory.PARAMS_PROXY_DETECTOR), "proxyDetector");
|
||||||
return new DnsNameResolver(
|
return new DnsNameResolver(
|
||||||
targetUri.getAuthority(),
|
targetUri.getAuthority(),
|
||||||
name,
|
name,
|
||||||
params,
|
params,
|
||||||
GrpcUtil.SHARED_CHANNEL_EXECUTOR,
|
GrpcUtil.SHARED_CHANNEL_EXECUTOR,
|
||||||
GrpcUtil.getDefaultProxyDetector(),
|
proxyDetector,
|
||||||
Stopwatch.createUnstarted(),
|
Stopwatch.createUnstarted(),
|
||||||
InternalServiceProviders.isAndroid(getClass().getClassLoader()));
|
InternalServiceProviders.isAndroid(getClass().getClassLoader()));
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,8 @@ import io.grpc.LoadBalancer.PickResult;
|
||||||
import io.grpc.LoadBalancer.Subchannel;
|
import io.grpc.LoadBalancer.Subchannel;
|
||||||
import io.grpc.Metadata;
|
import io.grpc.Metadata;
|
||||||
import io.grpc.MethodDescriptor;
|
import io.grpc.MethodDescriptor;
|
||||||
|
import io.grpc.ProxyDetector;
|
||||||
|
import io.grpc.ProxyParameters;
|
||||||
import io.grpc.Status;
|
import io.grpc.Status;
|
||||||
import io.grpc.internal.ClientStreamListener.RpcProgress;
|
import io.grpc.internal.ClientStreamListener.RpcProgress;
|
||||||
import io.grpc.internal.SharedResourceHolder.Resource;
|
import io.grpc.internal.SharedResourceHolder.Resource;
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,7 @@ import io.grpc.InternalLogId;
|
||||||
import io.grpc.InternalWithLogId;
|
import io.grpc.InternalWithLogId;
|
||||||
import io.grpc.Metadata;
|
import io.grpc.Metadata;
|
||||||
import io.grpc.MethodDescriptor;
|
import io.grpc.MethodDescriptor;
|
||||||
|
import io.grpc.ProxyParameters;
|
||||||
import io.grpc.Status;
|
import io.grpc.Status;
|
||||||
import io.grpc.SynchronizationContext;
|
import io.grpc.SynchronizationContext;
|
||||||
import java.net.SocketAddress;
|
import java.net.SocketAddress;
|
||||||
|
|
|
||||||
|
|
@ -60,6 +60,7 @@ import io.grpc.ManagedChannel;
|
||||||
import io.grpc.Metadata;
|
import io.grpc.Metadata;
|
||||||
import io.grpc.MethodDescriptor;
|
import io.grpc.MethodDescriptor;
|
||||||
import io.grpc.NameResolver;
|
import io.grpc.NameResolver;
|
||||||
|
import io.grpc.ProxyDetector;
|
||||||
import io.grpc.Status;
|
import io.grpc.Status;
|
||||||
import io.grpc.SynchronizationContext;
|
import io.grpc.SynchronizationContext;
|
||||||
import io.grpc.SynchronizationContext.ScheduledHandle;
|
import io.grpc.SynchronizationContext.ScheduledHandle;
|
||||||
|
|
@ -135,6 +136,7 @@ final class ManagedChannelImpl extends ManagedChannel implements
|
||||||
private final ExecutorHolder balancerRpcExecutorHolder;
|
private final ExecutorHolder balancerRpcExecutorHolder;
|
||||||
private final TimeProvider timeProvider;
|
private final TimeProvider timeProvider;
|
||||||
private final int maxTraceEvents;
|
private final int maxTraceEvents;
|
||||||
|
private final ProxyDetector proxyDetector;
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
final SynchronizationContext syncContext = new SynchronizationContext(
|
final SynchronizationContext syncContext = new SynchronizationContext(
|
||||||
|
|
@ -543,7 +545,10 @@ final class ManagedChannelImpl extends ManagedChannel implements
|
||||||
this.target = checkNotNull(builder.target, "target");
|
this.target = checkNotNull(builder.target, "target");
|
||||||
this.logId = InternalLogId.allocate("Channel", target);
|
this.logId = InternalLogId.allocate("Channel", target);
|
||||||
this.nameResolverFactory = builder.getNameResolverFactory();
|
this.nameResolverFactory = builder.getNameResolverFactory();
|
||||||
this.nameResolverParams = checkNotNull(builder.getNameResolverParams(), "nameResolverParams");
|
this.proxyDetector =
|
||||||
|
builder.proxyDetector != null ? builder.proxyDetector : GrpcUtil.getDefaultProxyDetector();
|
||||||
|
this.nameResolverParams = addProxyToAttributes(this.proxyDetector,
|
||||||
|
checkNotNull(builder.getNameResolverParams(), "nameResolverParams"));
|
||||||
this.nameResolver = getNameResolver(target, nameResolverFactory, nameResolverParams);
|
this.nameResolver = getNameResolver(target, nameResolverFactory, nameResolverParams);
|
||||||
this.timeProvider = checkNotNull(timeProvider, "timeProvider");
|
this.timeProvider = checkNotNull(timeProvider, "timeProvider");
|
||||||
maxTraceEvents = builder.maxTraceEvents;
|
maxTraceEvents = builder.maxTraceEvents;
|
||||||
|
|
@ -612,6 +617,16 @@ final class ManagedChannelImpl extends ManagedChannel implements
|
||||||
channelz.addRootChannel(this);
|
channelz.addRootChannel(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static Attributes addProxyToAttributes(ProxyDetector proxyDetector,
|
||||||
|
Attributes attributes) {
|
||||||
|
if (attributes.get(NameResolver.Factory.PARAMS_PROXY_DETECTOR) == null) {
|
||||||
|
return attributes.toBuilder()
|
||||||
|
.set(NameResolver.Factory.PARAMS_PROXY_DETECTOR, proxyDetector).build();
|
||||||
|
} else {
|
||||||
|
return attributes;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
static NameResolver getNameResolver(String target, NameResolver.Factory nameResolverFactory,
|
static NameResolver getNameResolver(String target, NameResolver.Factory nameResolverFactory,
|
||||||
Attributes nameResolverParams) {
|
Attributes nameResolverParams) {
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,8 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
import com.google.common.annotations.VisibleForTesting;
|
import com.google.common.annotations.VisibleForTesting;
|
||||||
import com.google.common.base.Supplier;
|
import com.google.common.base.Supplier;
|
||||||
|
import io.grpc.ProxyDetector;
|
||||||
|
import io.grpc.ProxyParameters;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.Authenticator;
|
import java.net.Authenticator;
|
||||||
import java.net.InetAddress;
|
import java.net.InetAddress;
|
||||||
|
|
@ -176,7 +178,7 @@ class ProxyDetectorImpl implements ProxyDetector {
|
||||||
this.proxySelector = checkNotNull(proxySelector);
|
this.proxySelector = checkNotNull(proxySelector);
|
||||||
this.authenticationProvider = checkNotNull(authenticationProvider);
|
this.authenticationProvider = checkNotNull(authenticationProvider);
|
||||||
if (proxyEnvString != null) {
|
if (proxyEnvString != null) {
|
||||||
override = new ProxyParameters(overrideProxy(proxyEnvString), null, null);
|
override = ProxyParameters.forAddress(overrideProxy(proxyEnvString)).build();
|
||||||
} else {
|
} else {
|
||||||
override = null;
|
override = null;
|
||||||
}
|
}
|
||||||
|
|
@ -258,12 +260,14 @@ class ProxyDetectorImpl implements ProxyDetector {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (auth == null) {
|
if (auth == null) {
|
||||||
return new ProxyParameters(resolvedProxyAddr, null, null);
|
return ProxyParameters.forAddress(resolvedProxyAddr).build();
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(spencerfang): users of ProxyParameters should clear the password when done
|
return ProxyParameters
|
||||||
return new ProxyParameters(
|
.forAddress(resolvedProxyAddr)
|
||||||
resolvedProxyAddr, auth.getUserName(), new String(auth.getPassword()));
|
.username(auth.getUserName())
|
||||||
|
.password(auth.getPassword() == null ? null : new String(auth.getPassword()))
|
||||||
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@
|
||||||
package io.grpc.internal;
|
package io.grpc.internal;
|
||||||
|
|
||||||
import com.google.common.base.Preconditions;
|
import com.google.common.base.Preconditions;
|
||||||
|
import io.grpc.ProxyParameters;
|
||||||
import java.net.SocketAddress;
|
import java.net.SocketAddress;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@ import static com.google.common.truth.Truth.assertThat;
|
||||||
|
|
||||||
import com.google.common.testing.EqualsTester;
|
import com.google.common.testing.EqualsTester;
|
||||||
import io.grpc.Attributes;
|
import io.grpc.Attributes;
|
||||||
|
import io.grpc.ProxyParameters;
|
||||||
import io.grpc.internal.ClientTransportFactory.ClientTransportOptions;
|
import io.grpc.internal.ClientTransportFactory.ClientTransportOptions;
|
||||||
import java.net.InetSocketAddress;
|
import java.net.InetSocketAddress;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
@ -33,7 +34,7 @@ public final class ClientTransportFactoryTest {
|
||||||
Attributes.newBuilder().set(Attributes.Key.create("fake key"), "fake value").build();
|
Attributes.newBuilder().set(Attributes.Key.create("fake key"), "fake value").build();
|
||||||
private String userAgent = "best-ua/3.14";
|
private String userAgent = "best-ua/3.14";
|
||||||
private ProxyParameters proxyParameters =
|
private ProxyParameters proxyParameters =
|
||||||
new ProxyParameters(new InetSocketAddress(0), null, null);
|
ProxyParameters.forAddress(new InetSocketAddress(0)).build();
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void clientTransportOptions_init_checkNotNulls() {
|
public void clientTransportOptions_init_checkNotNulls() {
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ import static org.junit.Assert.assertSame;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
import io.grpc.Attributes;
|
import io.grpc.Attributes;
|
||||||
|
import io.grpc.NameResolver;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
|
|
@ -29,6 +30,12 @@ import org.junit.runners.JUnit4;
|
||||||
/** Unit tests for {@link DnsNameResolverProvider}. */
|
/** Unit tests for {@link DnsNameResolverProvider}. */
|
||||||
@RunWith(JUnit4.class)
|
@RunWith(JUnit4.class)
|
||||||
public class DnsNameResolverProviderTest {
|
public class DnsNameResolverProviderTest {
|
||||||
|
|
||||||
|
private static final Attributes ATTRIBUTES =
|
||||||
|
Attributes.newBuilder()
|
||||||
|
.set(NameResolver.Factory.PARAMS_PROXY_DETECTOR, GrpcUtil.getDefaultProxyDetector())
|
||||||
|
.build();
|
||||||
|
|
||||||
private DnsNameResolverProvider provider = new DnsNameResolverProvider();
|
private DnsNameResolverProvider provider = new DnsNameResolverProvider();
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
@ -39,8 +46,8 @@ public class DnsNameResolverProviderTest {
|
||||||
@Test
|
@Test
|
||||||
public void newNameResolver() {
|
public void newNameResolver() {
|
||||||
assertSame(DnsNameResolver.class,
|
assertSame(DnsNameResolver.class,
|
||||||
provider.newNameResolver(URI.create("dns:///localhost:443"), Attributes.EMPTY).getClass());
|
provider.newNameResolver(URI.create("dns:///localhost:443"), ATTRIBUTES).getClass());
|
||||||
assertNull(
|
assertNull(
|
||||||
provider.newNameResolver(URI.create("notdns:///localhost:443"), Attributes.EMPTY));
|
provider.newNameResolver(URI.create("notdns:///localhost:443"), ATTRIBUTES));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,8 @@ import com.google.common.testing.FakeTicker;
|
||||||
import io.grpc.Attributes;
|
import io.grpc.Attributes;
|
||||||
import io.grpc.EquivalentAddressGroup;
|
import io.grpc.EquivalentAddressGroup;
|
||||||
import io.grpc.NameResolver;
|
import io.grpc.NameResolver;
|
||||||
|
import io.grpc.ProxyDetector;
|
||||||
|
import io.grpc.ProxyParameters;
|
||||||
import io.grpc.Status;
|
import io.grpc.Status;
|
||||||
import io.grpc.Status.Code;
|
import io.grpc.Status.Code;
|
||||||
import io.grpc.internal.DnsNameResolver.AddressResolver;
|
import io.grpc.internal.DnsNameResolver.AddressResolver;
|
||||||
|
|
@ -92,7 +94,10 @@ public class DnsNameResolverTest {
|
||||||
|
|
||||||
private static final int DEFAULT_PORT = 887;
|
private static final int DEFAULT_PORT = 887;
|
||||||
private static final Attributes NAME_RESOLVER_PARAMS =
|
private static final Attributes NAME_RESOLVER_PARAMS =
|
||||||
Attributes.newBuilder().set(NameResolver.Factory.PARAMS_DEFAULT_PORT, DEFAULT_PORT).build();
|
Attributes.newBuilder()
|
||||||
|
.set(NameResolver.Factory.PARAMS_DEFAULT_PORT, DEFAULT_PORT)
|
||||||
|
.set(NameResolver.Factory.PARAMS_PROXY_DETECTOR, GrpcUtil.getDefaultProxyDetector())
|
||||||
|
.build();
|
||||||
|
|
||||||
private final DnsNameResolverProvider provider = new DnsNameResolverProvider();
|
private final DnsNameResolverProvider provider = new DnsNameResolverProvider();
|
||||||
private final FakeClock fakeClock = new FakeClock();
|
private final FakeClock fakeClock = new FakeClock();
|
||||||
|
|
@ -272,7 +277,9 @@ public class DnsNameResolverTest {
|
||||||
public void resolveAll_failsOnEmptyResult() throws Exception {
|
public void resolveAll_failsOnEmptyResult() throws Exception {
|
||||||
String hostname = "dns:///addr.fake:1234";
|
String hostname = "dns:///addr.fake:1234";
|
||||||
DnsNameResolver nrf =
|
DnsNameResolver nrf =
|
||||||
new DnsNameResolverProvider().newNameResolver(new URI(hostname), Attributes.EMPTY);
|
new DnsNameResolverProvider().newNameResolver(new URI(hostname), Attributes.newBuilder()
|
||||||
|
.set(NameResolver.Factory.PARAMS_PROXY_DETECTOR, GrpcUtil.getDefaultProxyDetector())
|
||||||
|
.build());
|
||||||
nrf.setAddressResolver(new AddressResolver() {
|
nrf.setAddressResolver(new AddressResolver() {
|
||||||
@Override
|
@Override
|
||||||
public List<InetAddress> resolveAddress(String host) throws Exception {
|
public List<InetAddress> resolveAddress(String host) throws Exception {
|
||||||
|
|
@ -576,10 +583,11 @@ public class DnsNameResolverTest {
|
||||||
final String name = "foo.googleapis.com";
|
final String name = "foo.googleapis.com";
|
||||||
final int port = 81;
|
final int port = 81;
|
||||||
ProxyDetector alwaysDetectProxy = mock(ProxyDetector.class);
|
ProxyDetector alwaysDetectProxy = mock(ProxyDetector.class);
|
||||||
ProxyParameters proxyParameters = new ProxyParameters(
|
ProxyParameters proxyParameters = ProxyParameters
|
||||||
new InetSocketAddress(InetAddress.getByName("10.0.0.1"), 1000),
|
.forAddress(
|
||||||
"username",
|
new InetSocketAddress(InetAddress.getByName("10.0.0.1"), 1000))
|
||||||
"password");
|
.username("username")
|
||||||
|
.password("password").build();
|
||||||
when(alwaysDetectProxy.proxyFor(any(SocketAddress.class)))
|
when(alwaysDetectProxy.proxyFor(any(SocketAddress.class)))
|
||||||
.thenReturn(proxyParameters);
|
.thenReturn(proxyParameters);
|
||||||
DnsNameResolver resolver =
|
DnsNameResolver resolver =
|
||||||
|
|
|
||||||
|
|
@ -143,7 +143,10 @@ import org.mockito.stubbing.Answer;
|
||||||
@RunWith(JUnit4.class)
|
@RunWith(JUnit4.class)
|
||||||
public class ManagedChannelImplTest {
|
public class ManagedChannelImplTest {
|
||||||
private static final Attributes NAME_RESOLVER_PARAMS =
|
private static final Attributes NAME_RESOLVER_PARAMS =
|
||||||
Attributes.newBuilder().set(NameResolver.Factory.PARAMS_DEFAULT_PORT, 447).build();
|
Attributes.newBuilder()
|
||||||
|
.set(NameResolver.Factory.PARAMS_DEFAULT_PORT, 447)
|
||||||
|
.set(NameResolver.Factory.PARAMS_PROXY_DETECTOR, GrpcUtil.getDefaultProxyDetector())
|
||||||
|
.build();
|
||||||
|
|
||||||
private static final MethodDescriptor<String, Integer> method =
|
private static final MethodDescriptor<String, Integer> method =
|
||||||
MethodDescriptor.<String, Integer>newBuilder()
|
MethodDescriptor.<String, Integer>newBuilder()
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,8 @@ import static org.mockito.Mockito.when;
|
||||||
|
|
||||||
import com.google.common.base.Supplier;
|
import com.google.common.base.Supplier;
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
|
import io.grpc.ProxyDetector;
|
||||||
|
import io.grpc.ProxyParameters;
|
||||||
import java.net.InetAddress;
|
import java.net.InetAddress;
|
||||||
import java.net.InetSocketAddress;
|
import java.net.InetSocketAddress;
|
||||||
import java.net.PasswordAuthentication;
|
import java.net.PasswordAuthentication;
|
||||||
|
|
@ -66,10 +68,10 @@ public class ProxyDetectorImplTest {
|
||||||
proxyDetector = new ProxyDetectorImpl(proxySelectorSupplier, authenticator, null);
|
proxyDetector = new ProxyDetectorImpl(proxySelectorSupplier, authenticator, null);
|
||||||
int proxyPort = 1234;
|
int proxyPort = 1234;
|
||||||
unresolvedProxy = InetSocketAddress.createUnresolved("10.0.0.1", proxyPort);
|
unresolvedProxy = InetSocketAddress.createUnresolved("10.0.0.1", proxyPort);
|
||||||
proxyParmeters = new ProxyParameters(
|
proxyParmeters = ProxyParameters
|
||||||
new InetSocketAddress(InetAddress.getByName(unresolvedProxy.getHostName()), proxyPort),
|
.forAddress(
|
||||||
NO_USER,
|
new InetSocketAddress(InetAddress.getByName(unresolvedProxy.getHostName()), proxyPort))
|
||||||
NO_PW);
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
@ -84,10 +86,10 @@ public class ProxyDetectorImplTest {
|
||||||
ProxyParameters detected = proxyDetector.proxyFor(destination);
|
ProxyParameters detected = proxyDetector.proxyFor(destination);
|
||||||
assertNotNull(detected);
|
assertNotNull(detected);
|
||||||
assertEquals(
|
assertEquals(
|
||||||
new ProxyParameters(
|
ProxyParameters
|
||||||
new InetSocketAddress(InetAddress.getByName(overrideHost), overridePort),
|
.forAddress(
|
||||||
NO_USER,
|
new InetSocketAddress(InetAddress.getByName(overrideHost), overridePort))
|
||||||
NO_PW),
|
.build(),
|
||||||
detected);
|
detected);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -102,11 +104,10 @@ public class ProxyDetectorImplTest {
|
||||||
ProxyParameters detected = proxyDetector.proxyFor(destination);
|
ProxyParameters detected = proxyDetector.proxyFor(destination);
|
||||||
assertNotNull(detected);
|
assertNotNull(detected);
|
||||||
assertEquals(
|
assertEquals(
|
||||||
new ProxyParameters(
|
ProxyParameters.forAddress(
|
||||||
new InetSocketAddress(
|
new InetSocketAddress(
|
||||||
InetAddress.getByName(overrideHostWithoutPort), defaultPort),
|
InetAddress.getByName(overrideHostWithoutPort), defaultPort))
|
||||||
NO_USER,
|
.build(),
|
||||||
NO_PW),
|
|
||||||
detected);
|
detected);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -148,7 +149,7 @@ public class ProxyDetectorImplTest {
|
||||||
Proxy proxy1 = new java.net.Proxy(java.net.Proxy.Type.HTTP, unresolvedProxy);
|
Proxy proxy1 = new java.net.Proxy(java.net.Proxy.Type.HTTP, unresolvedProxy);
|
||||||
when(proxySelector.select(any(URI.class))).thenReturn(ImmutableList.of(proxy1));
|
when(proxySelector.select(any(URI.class))).thenReturn(ImmutableList.of(proxy1));
|
||||||
ProxyParameters proxy = proxyDetector.proxyFor(destination);
|
ProxyParameters proxy = proxyDetector.proxyFor(destination);
|
||||||
assertFalse(proxy.proxyAddress.isUnresolved());
|
assertFalse(((InetSocketAddress)proxy.getProxyAddress()).isUnresolved());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
@ -189,12 +190,13 @@ public class ProxyDetectorImplTest {
|
||||||
|
|
||||||
ProxyParameters detected = proxyDetector.proxyFor(destination);
|
ProxyParameters detected = proxyDetector.proxyFor(destination);
|
||||||
assertEquals(
|
assertEquals(
|
||||||
new ProxyParameters(
|
ProxyParameters.forAddress(
|
||||||
new InetSocketAddress(
|
new InetSocketAddress(
|
||||||
InetAddress.getByName(unresolvedProxy.getHostName()),
|
InetAddress.getByName(unresolvedProxy.getHostName()),
|
||||||
unresolvedProxy.getPort()),
|
unresolvedProxy.getPort()))
|
||||||
proxyUser,
|
.username(proxyUser)
|
||||||
proxyPassword),
|
.password(proxyPassword)
|
||||||
|
.build(),
|
||||||
detected);
|
detected);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,6 @@ import io.grpc.internal.AbstractManagedChannelImplBuilder;
|
||||||
import io.grpc.internal.ClientTransportFactory;
|
import io.grpc.internal.ClientTransportFactory;
|
||||||
import io.grpc.internal.ConnectionClientTransport;
|
import io.grpc.internal.ConnectionClientTransport;
|
||||||
import io.grpc.internal.GrpcUtil;
|
import io.grpc.internal.GrpcUtil;
|
||||||
import io.grpc.internal.ProxyParameters;
|
|
||||||
import io.grpc.internal.SharedResourceHolder;
|
import io.grpc.internal.SharedResourceHolder;
|
||||||
import io.grpc.internal.TransportTracer;
|
import io.grpc.internal.TransportTracer;
|
||||||
import java.net.InetSocketAddress;
|
import java.net.InetSocketAddress;
|
||||||
|
|
|
||||||
|
|
@ -30,13 +30,13 @@ import io.grpc.EquivalentAddressGroup;
|
||||||
import io.grpc.ExperimentalApi;
|
import io.grpc.ExperimentalApi;
|
||||||
import io.grpc.Internal;
|
import io.grpc.Internal;
|
||||||
import io.grpc.NameResolver;
|
import io.grpc.NameResolver;
|
||||||
|
import io.grpc.ProxyParameters;
|
||||||
import io.grpc.internal.AbstractManagedChannelImplBuilder;
|
import io.grpc.internal.AbstractManagedChannelImplBuilder;
|
||||||
import io.grpc.internal.AtomicBackoff;
|
import io.grpc.internal.AtomicBackoff;
|
||||||
import io.grpc.internal.ClientTransportFactory;
|
import io.grpc.internal.ClientTransportFactory;
|
||||||
import io.grpc.internal.ConnectionClientTransport;
|
import io.grpc.internal.ConnectionClientTransport;
|
||||||
import io.grpc.internal.GrpcUtil;
|
import io.grpc.internal.GrpcUtil;
|
||||||
import io.grpc.internal.KeepAliveManager;
|
import io.grpc.internal.KeepAliveManager;
|
||||||
import io.grpc.internal.ProxyParameters;
|
|
||||||
import io.grpc.internal.SharedResourceHolder;
|
import io.grpc.internal.SharedResourceHolder;
|
||||||
import io.grpc.internal.TransportTracer;
|
import io.grpc.internal.TransportTracer;
|
||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
|
|
@ -547,7 +547,9 @@ public final class NettyChannelBuilder
|
||||||
ProxyParameters proxyParams = options.getProxyParameters();
|
ProxyParameters proxyParams = options.getProxyParameters();
|
||||||
if (proxyParams != null) {
|
if (proxyParams != null) {
|
||||||
localNegotiator = ProtocolNegotiators.httpProxy(
|
localNegotiator = ProtocolNegotiators.httpProxy(
|
||||||
proxyParams.proxyAddress, proxyParams.username, proxyParams.password,
|
proxyParams.getProxyAddress(),
|
||||||
|
proxyParams.getUsername(),
|
||||||
|
proxyParams.getPassword(),
|
||||||
protocolNegotiator);
|
protocolNegotiator);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ import static org.junit.Assert.assertTrue;
|
||||||
import static org.mockito.Mockito.mock;
|
import static org.mockito.Mockito.mock;
|
||||||
|
|
||||||
import io.grpc.ManagedChannel;
|
import io.grpc.ManagedChannel;
|
||||||
import io.grpc.internal.ProxyParameters;
|
import io.grpc.ProxyParameters;
|
||||||
import io.grpc.netty.InternalNettyChannelBuilder.OverrideAuthorityChecker;
|
import io.grpc.netty.InternalNettyChannelBuilder.OverrideAuthorityChecker;
|
||||||
import io.grpc.netty.ProtocolNegotiators.TlsNegotiator;
|
import io.grpc.netty.ProtocolNegotiators.TlsNegotiator;
|
||||||
import io.netty.handler.ssl.SslContext;
|
import io.netty.handler.ssl.SslContext;
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,7 @@ import io.grpc.InternalLogId;
|
||||||
import io.grpc.Metadata;
|
import io.grpc.Metadata;
|
||||||
import io.grpc.MethodDescriptor;
|
import io.grpc.MethodDescriptor;
|
||||||
import io.grpc.MethodDescriptor.MethodType;
|
import io.grpc.MethodDescriptor.MethodType;
|
||||||
|
import io.grpc.ProxyParameters;
|
||||||
import io.grpc.SecurityLevel;
|
import io.grpc.SecurityLevel;
|
||||||
import io.grpc.Status;
|
import io.grpc.Status;
|
||||||
import io.grpc.Status.Code;
|
import io.grpc.Status.Code;
|
||||||
|
|
@ -52,7 +53,6 @@ import io.grpc.internal.Http2Ping;
|
||||||
import io.grpc.internal.InUseStateAggregator;
|
import io.grpc.internal.InUseStateAggregator;
|
||||||
import io.grpc.internal.KeepAliveManager;
|
import io.grpc.internal.KeepAliveManager;
|
||||||
import io.grpc.internal.KeepAliveManager.ClientKeepAlivePinger;
|
import io.grpc.internal.KeepAliveManager.ClientKeepAlivePinger;
|
||||||
import io.grpc.internal.ProxyParameters;
|
|
||||||
import io.grpc.internal.SerializingExecutor;
|
import io.grpc.internal.SerializingExecutor;
|
||||||
import io.grpc.internal.SharedResourceHolder;
|
import io.grpc.internal.SharedResourceHolder;
|
||||||
import io.grpc.internal.StatsTraceContext;
|
import io.grpc.internal.StatsTraceContext;
|
||||||
|
|
@ -507,10 +507,19 @@ class OkHttpClientTransport implements ConnectionClientTransport, TransportExcep
|
||||||
if (proxy == null) {
|
if (proxy == null) {
|
||||||
sock = new Socket(address.getAddress(), address.getPort());
|
sock = new Socket(address.getAddress(), address.getPort());
|
||||||
} else {
|
} else {
|
||||||
sock = createHttpProxySocket(
|
if (proxy.getProxyAddress() instanceof InetSocketAddress) {
|
||||||
address, proxy.proxyAddress, proxy.username, proxy.password);
|
sock = createHttpProxySocket(
|
||||||
|
address,
|
||||||
|
(InetSocketAddress)proxy.getProxyAddress(),
|
||||||
|
proxy.getUsername(),
|
||||||
|
proxy.getPassword()
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
throw Status.INTERNAL.withDescription(
|
||||||
|
"Unsupported SocketAddress implementation " + proxy.getProxyAddress().getClass())
|
||||||
|
.asException();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sslSocketFactory != null) {
|
if (sslSocketFactory != null) {
|
||||||
SSLSocket sslSocket = OkHttpTlsUpgrader.upgrade(
|
SSLSocket sslSocket = OkHttpTlsUpgrader.upgrade(
|
||||||
sslSocketFactory, hostnameVerifier, sock, getOverridenHost(), getOverridenPort(),
|
sslSocketFactory, hostnameVerifier, sock, getOverridenHost(), getOverridenPort(),
|
||||||
|
|
|
||||||
|
|
@ -62,6 +62,7 @@ import io.grpc.InternalStatus;
|
||||||
import io.grpc.Metadata;
|
import io.grpc.Metadata;
|
||||||
import io.grpc.MethodDescriptor;
|
import io.grpc.MethodDescriptor;
|
||||||
import io.grpc.MethodDescriptor.MethodType;
|
import io.grpc.MethodDescriptor.MethodType;
|
||||||
|
import io.grpc.ProxyParameters;
|
||||||
import io.grpc.Status;
|
import io.grpc.Status;
|
||||||
import io.grpc.Status.Code;
|
import io.grpc.Status.Code;
|
||||||
import io.grpc.StatusException;
|
import io.grpc.StatusException;
|
||||||
|
|
@ -70,7 +71,6 @@ import io.grpc.internal.ClientStreamListener;
|
||||||
import io.grpc.internal.ClientTransport;
|
import io.grpc.internal.ClientTransport;
|
||||||
import io.grpc.internal.GrpcUtil;
|
import io.grpc.internal.GrpcUtil;
|
||||||
import io.grpc.internal.ManagedClientTransport;
|
import io.grpc.internal.ManagedClientTransport;
|
||||||
import io.grpc.internal.ProxyParameters;
|
|
||||||
import io.grpc.internal.TransportTracer;
|
import io.grpc.internal.TransportTracer;
|
||||||
import io.grpc.okhttp.OkHttpClientTransport.ClientFrameHandler;
|
import io.grpc.okhttp.OkHttpClientTransport.ClientFrameHandler;
|
||||||
import io.grpc.okhttp.internal.ConnectionSpec;
|
import io.grpc.okhttp.internal.ConnectionSpec;
|
||||||
|
|
@ -1573,8 +1573,8 @@ public class OkHttpClientTransportTest {
|
||||||
ConnectionSpec.CLEARTEXT,
|
ConnectionSpec.CLEARTEXT,
|
||||||
DEFAULT_MAX_MESSAGE_SIZE,
|
DEFAULT_MAX_MESSAGE_SIZE,
|
||||||
INITIAL_WINDOW_SIZE,
|
INITIAL_WINDOW_SIZE,
|
||||||
new ProxyParameters(
|
ProxyParameters.forAddress(
|
||||||
(InetSocketAddress) serverSocket.getLocalSocketAddress(), NO_USER, NO_PW),
|
(InetSocketAddress) serverSocket.getLocalSocketAddress()).build(),
|
||||||
tooManyPingsRunnable,
|
tooManyPingsRunnable,
|
||||||
DEFAULT_MAX_INBOUND_METADATA_SIZE,
|
DEFAULT_MAX_INBOUND_METADATA_SIZE,
|
||||||
transportTracer);
|
transportTracer);
|
||||||
|
|
@ -1625,8 +1625,8 @@ public class OkHttpClientTransportTest {
|
||||||
ConnectionSpec.CLEARTEXT,
|
ConnectionSpec.CLEARTEXT,
|
||||||
DEFAULT_MAX_MESSAGE_SIZE,
|
DEFAULT_MAX_MESSAGE_SIZE,
|
||||||
INITIAL_WINDOW_SIZE,
|
INITIAL_WINDOW_SIZE,
|
||||||
new ProxyParameters(
|
ProxyParameters.forAddress(
|
||||||
(InetSocketAddress) serverSocket.getLocalSocketAddress(), NO_USER, NO_PW),
|
(InetSocketAddress) serverSocket.getLocalSocketAddress()).build(),
|
||||||
tooManyPingsRunnable,
|
tooManyPingsRunnable,
|
||||||
DEFAULT_MAX_INBOUND_METADATA_SIZE,
|
DEFAULT_MAX_INBOUND_METADATA_SIZE,
|
||||||
transportTracer);
|
transportTracer);
|
||||||
|
|
@ -1676,8 +1676,8 @@ public class OkHttpClientTransportTest {
|
||||||
ConnectionSpec.CLEARTEXT,
|
ConnectionSpec.CLEARTEXT,
|
||||||
DEFAULT_MAX_MESSAGE_SIZE,
|
DEFAULT_MAX_MESSAGE_SIZE,
|
||||||
INITIAL_WINDOW_SIZE,
|
INITIAL_WINDOW_SIZE,
|
||||||
new ProxyParameters(
|
ProxyParameters.forAddress(
|
||||||
(InetSocketAddress) serverSocket.getLocalSocketAddress(), NO_USER, NO_PW),
|
(InetSocketAddress) serverSocket.getLocalSocketAddress()).build(),
|
||||||
tooManyPingsRunnable,
|
tooManyPingsRunnable,
|
||||||
DEFAULT_MAX_INBOUND_METADATA_SIZE,
|
DEFAULT_MAX_INBOUND_METADATA_SIZE,
|
||||||
transportTracer);
|
transportTracer);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue