当前位置: 首页>>代码示例>>Java>>正文


Java GrpcUtil.getGrpcUserAgent方法代码示例

本文整理汇总了Java中io.grpc.internal.GrpcUtil.getGrpcUserAgent方法的典型用法代码示例。如果您正苦于以下问题:Java GrpcUtil.getGrpcUserAgent方法的具体用法?Java GrpcUtil.getGrpcUserAgent怎么用?Java GrpcUtil.getGrpcUserAgent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在io.grpc.internal.GrpcUtil的用法示例。


在下文中一共展示了GrpcUtil.getGrpcUserAgent方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: CronetClientTransport

import io.grpc.internal.GrpcUtil; //导入方法依赖的package包/类
CronetClientTransport(
    StreamBuilderFactory streamFactory,
    InetSocketAddress address,
    String authority,
    @Nullable String userAgent,
    Executor executor,
    int maxMessageSize,
    boolean alwaysUsePut,
    TransportTracer transportTracer) {
  this.address = Preconditions.checkNotNull(address, "address");
  this.authority = authority;
  this.userAgent = GrpcUtil.getGrpcUserAgent("cronet", userAgent);
  this.maxMessageSize = maxMessageSize;
  this.alwaysUsePut = alwaysUsePut;
  this.executor = Preconditions.checkNotNull(executor, "executor");
  this.streamFactory = Preconditions.checkNotNull(streamFactory, "streamFactory");
  this.transportTracer = Preconditions.checkNotNull(transportTracer, "transportTracer");
}
 
开发者ID:grpc,项目名称:grpc-java,代码行数:19,代码来源:CronetClientTransport.java

示例2: addDefaultUserAgent

import io.grpc.internal.GrpcUtil; //导入方法依赖的package包/类
@Test
public void addDefaultUserAgent() throws Exception {
  initTransport();
  MockStreamListener listener = new MockStreamListener();
  OkHttpClientStream stream =
      clientTransport.newStream(method, new Metadata(), CallOptions.DEFAULT);
  stream.start(listener);
  Header userAgentHeader = new Header(GrpcUtil.USER_AGENT_KEY.name(),
          GrpcUtil.getGrpcUserAgent("okhttp", null));
  List<Header> expectedHeaders = Arrays.asList(SCHEME_HEADER, METHOD_HEADER,
          new Header(Header.TARGET_AUTHORITY, "notarealauthority:80"),
          new Header(Header.TARGET_PATH, "/" + method.getFullMethodName()),
          userAgentHeader, CONTENT_TYPE_HEADER, TE_HEADER);
  verify(frameWriter, timeout(TIME_OUT_MS))
      .synStream(eq(false), eq(false), eq(3), eq(0), eq(expectedHeaders));
  getStream(3).cancel(Status.CANCELLED);
  shutdownAndVerify();
}
 
开发者ID:grpc,项目名称:grpc-java,代码行数:19,代码来源:OkHttpClientTransportTest.java

示例3: NettyClientTransport

import io.grpc.internal.GrpcUtil; //导入方法依赖的package包/类
NettyClientTransport(
    SocketAddress address, Class<? extends Channel> channelType,
    Map<ChannelOption<?>, ?> channelOptions, EventLoopGroup group,
    ProtocolNegotiator negotiator, int flowControlWindow, int maxMessageSize,
    int maxHeaderListSize, long keepAliveTimeNanos, long keepAliveTimeoutNanos,
    boolean keepAliveWithoutCalls, String authority, @Nullable String userAgent,
    Runnable tooManyPingsRunnable, TransportTracer transportTracer) {
  this.negotiator = Preconditions.checkNotNull(negotiator, "negotiator");
  this.address = Preconditions.checkNotNull(address, "address");
  this.group = Preconditions.checkNotNull(group, "group");
  this.channelType = Preconditions.checkNotNull(channelType, "channelType");
  this.channelOptions = Preconditions.checkNotNull(channelOptions, "channelOptions");
  this.flowControlWindow = flowControlWindow;
  this.maxMessageSize = maxMessageSize;
  this.maxHeaderListSize = maxHeaderListSize;
  this.keepAliveTimeNanos = keepAliveTimeNanos;
  this.keepAliveTimeoutNanos = keepAliveTimeoutNanos;
  this.keepAliveWithoutCalls = keepAliveWithoutCalls;
  this.authority = new AsciiString(authority);
  this.userAgent = new AsciiString(GrpcUtil.getGrpcUserAgent("netty", userAgent));
  this.tooManyPingsRunnable =
      Preconditions.checkNotNull(tooManyPingsRunnable, "tooManyPingsRunnable");
  this.transportTracer = Preconditions.checkNotNull(transportTracer, "transportTracer");
}
 
开发者ID:grpc,项目名称:grpc-java,代码行数:25,代码来源:NettyClientTransport.java

示例4: OkHttpClientTransport

import io.grpc.internal.GrpcUtil; //导入方法依赖的package包/类
OkHttpClientTransport(InetSocketAddress address, String authority, @Nullable String userAgent,
    Executor executor, @Nullable SSLSocketFactory sslSocketFactory,
    @Nullable HostnameVerifier hostnameVerifier, ConnectionSpec connectionSpec,
    int maxMessageSize, @Nullable InetSocketAddress proxyAddress, @Nullable String proxyUsername,
    @Nullable String proxyPassword, Runnable tooManyPingsRunnable,
    TransportTracer transportTracer) {
  this.address = Preconditions.checkNotNull(address, "address");
  this.defaultAuthority = authority;
  this.maxMessageSize = maxMessageSize;
  this.executor = Preconditions.checkNotNull(executor, "executor");
  serializingExecutor = new SerializingExecutor(executor);
  // Client initiated streams are odd, server initiated ones are even. Server should not need to
  // use it. We start clients at 3 to avoid conflicting with HTTP negotiation.
  nextStreamId = 3;
  this.sslSocketFactory = sslSocketFactory;
  this.hostnameVerifier = hostnameVerifier;
  this.connectionSpec = Preconditions.checkNotNull(connectionSpec, "connectionSpec");
  this.stopwatchFactory = GrpcUtil.STOPWATCH_SUPPLIER;
  this.userAgent = GrpcUtil.getGrpcUserAgent("okhttp", userAgent);
  this.proxyAddress = proxyAddress;
  this.proxyUsername = proxyUsername;
  this.proxyPassword = proxyPassword;
  this.tooManyPingsRunnable =
      Preconditions.checkNotNull(tooManyPingsRunnable, "tooManyPingsRunnable");
  this.transportTracer = Preconditions.checkNotNull(transportTracer);
  initTransportTracer();
}
 
开发者ID:grpc,项目名称:grpc-java,代码行数:28,代码来源:OkHttpClientTransport.java

示例5: InProcessTransport

import io.grpc.internal.GrpcUtil; //导入方法依赖的package包/类
public InProcessTransport(String name, String authority, String userAgent) {
  this.name = name;
  this.authority = authority;
  this.userAgent = GrpcUtil.getGrpcUserAgent("inprocess", userAgent);
}
 
开发者ID:grpc,项目名称:grpc-java,代码行数:6,代码来源:InProcessTransport.java


注:本文中的io.grpc.internal.GrpcUtil.getGrpcUserAgent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。