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


Java GrpcUtil.authorityFromHostAndPort方法代码示例

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


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

示例1: getAttributes_negotiatorHandler

import io.grpc.internal.GrpcUtil; //导入方法依赖的package包/类
@Test
public void getAttributes_negotiatorHandler() throws Exception {
  address = TestUtils.testServerAddress(12345);
  authority = GrpcUtil.authorityFromHostAndPort(address.getHostString(), address.getPort());

  NettyClientTransport transport = newTransport(
      new ProtocolNegotiator() {
        @Override
        public Handler newHandler(GrpcHttp2ConnectionHandler handler) {
          return null;
        }
      });

  assertEquals(Attributes.EMPTY, transport.getAttributes());

  transports.clear();
}
 
开发者ID:grpc,项目名称:grpc-java,代码行数:18,代码来源:NettyClientTransportTest.java

示例2: startServer

import io.grpc.internal.GrpcUtil; //导入方法依赖的package包/类
private void startServer(int maxStreamsPerConnection, int maxHeaderListSize) throws IOException {
  server = new NettyServer(
      TestUtils.testServerAddress(0),
      NioServerSocketChannel.class,
      new HashMap<ChannelOption<?>, Object>(),
      group, group, negotiator,
      Collections.<ServerStreamTracer.Factory>emptyList(),
      TransportTracer.getDefaultFactory(),
      maxStreamsPerConnection,
      DEFAULT_WINDOW_SIZE, DEFAULT_MAX_MESSAGE_SIZE, maxHeaderListSize,
      DEFAULT_SERVER_KEEPALIVE_TIME_NANOS, DEFAULT_SERVER_KEEPALIVE_TIMEOUT_NANOS,
      MAX_CONNECTION_IDLE_NANOS_DISABLED,
      MAX_CONNECTION_AGE_NANOS_DISABLED, MAX_CONNECTION_AGE_GRACE_NANOS_INFINITE, true, 0);
  server.start(serverListener);
  address = TestUtils.testServerAddress(server.getPort());
  authority = GrpcUtil.authorityFromHostAndPort(address.getHostString(), address.getPort());
}
 
开发者ID:grpc,项目名称:grpc-java,代码行数:18,代码来源:NettyClientTransportTest.java

示例3: getAuthorityFromAddress

import io.grpc.internal.GrpcUtil; //导入方法依赖的package包/类
@CheckReturnValue
private static String getAuthorityFromAddress(SocketAddress address) {
  if (address instanceof InetSocketAddress) {
    InetSocketAddress inetAddress = (InetSocketAddress) address;
    return GrpcUtil.authorityFromHostAndPort(inetAddress.getHostString(), inetAddress.getPort());
  } else {
    return address.toString();
  }
}
 
开发者ID:grpc,项目名称:grpc-java,代码行数:10,代码来源:NettyChannelBuilder.java

示例4: testToString

import io.grpc.internal.GrpcUtil; //导入方法依赖的package包/类
@Test
public void testToString() throws Exception {
  address = TestUtils.testServerAddress(12345);
  authority = GrpcUtil.authorityFromHostAndPort(address.getHostString(), address.getPort());
  String s = newTransport(newNegotiator()).toString();
  transports.clear();
  assertTrue("Unexpected: " + s, s.contains("NettyClientTransport"));
  assertTrue("Unexpected: " + s, s.contains(address.toString()));
}
 
开发者ID:grpc,项目名称:grpc-java,代码行数:10,代码来源:NettyClientTransportTest.java

示例5: CronetChannelBuilder

import io.grpc.internal.GrpcUtil; //导入方法依赖的package包/类
private CronetChannelBuilder(String host, int port, StreamBuilderFactory streamFactory) {
  super(
      InetSocketAddress.createUnresolved(host, port),
      GrpcUtil.authorityFromHostAndPort(host, port));
  this.streamFactory = Preconditions.checkNotNull(streamFactory, "streamFactory");
}
 
开发者ID:grpc,项目名称:grpc-java,代码行数:7,代码来源:CronetChannelBuilder.java

示例6: OkHttpChannelBuilder

import io.grpc.internal.GrpcUtil; //导入方法依赖的package包/类
protected OkHttpChannelBuilder(String host, int port) {
  this(GrpcUtil.authorityFromHostAndPort(host, port));
}
 
开发者ID:grpc,项目名称:grpc-java,代码行数:4,代码来源:OkHttpChannelBuilder.java

示例7: NettyChannelBuilder

import io.grpc.internal.GrpcUtil; //导入方法依赖的package包/类
@CheckReturnValue
NettyChannelBuilder(String host, int port) {
  this(GrpcUtil.authorityFromHostAndPort(host, port));
}
 
开发者ID:grpc,项目名称:grpc-java,代码行数:5,代码来源:NettyChannelBuilder.java


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