Search in sources :

Example 31 with ManagedChannel

use of io.grpc.ManagedChannel in project beam by apache.

the class ManagedChannelFactoryTest method testDefaultChannel.

@Test
public void testDefaultChannel() {
    ApiServiceDescriptor apiServiceDescriptor = ApiServiceDescriptor.newBuilder().setUrl("localhost:123").build();
    ManagedChannel channel = ManagedChannelFactory.from(PipelineOptionsFactory.create()).forDescriptor(apiServiceDescriptor);
    assertEquals("localhost:123", channel.authority());
    channel.shutdownNow();
}
Also used : ApiServiceDescriptor(org.apache.beam.fn.v1.BeamFnApi.ApiServiceDescriptor) ManagedChannel(io.grpc.ManagedChannel) Test(org.junit.Test)

Example 32 with ManagedChannel

use of io.grpc.ManagedChannel in project beam by apache.

the class ManagedChannelFactoryTest method testEpollDomainSocketChannel.

@Test
public void testEpollDomainSocketChannel() throws Exception {
    assumeTrue(io.netty.channel.epoll.Epoll.isAvailable());
    ApiServiceDescriptor apiServiceDescriptor = ApiServiceDescriptor.newBuilder().setUrl("unix://" + tmpFolder.newFile().getAbsolutePath()).build();
    ManagedChannel channel = ManagedChannelFactory.from(PipelineOptionsFactory.fromArgs(new String[] { "--experiments=beam_fn_api_epoll" }).create()).forDescriptor(apiServiceDescriptor);
    assertEquals(apiServiceDescriptor.getUrl().substring("unix://".length()), channel.authority());
    channel.shutdownNow();
}
Also used : ApiServiceDescriptor(org.apache.beam.fn.v1.BeamFnApi.ApiServiceDescriptor) ManagedChannel(io.grpc.ManagedChannel) Test(org.junit.Test)

Aggregations

ManagedChannel (io.grpc.ManagedChannel)32 Test (org.junit.Test)18 StreamObserver (io.grpc.stub.StreamObserver)8 CountDownLatch (java.util.concurrent.CountDownLatch)6 Metadata (io.grpc.Metadata)5 Server (io.grpc.Server)5 Status (io.grpc.Status)5 CallStreamObserver (io.grpc.stub.CallStreamObserver)5 AtomicReference (java.util.concurrent.atomic.AtomicReference)5 BeamFnApi (org.apache.beam.fn.v1.BeamFnApi)5 ConcurrentLinkedQueue (java.util.concurrent.ConcurrentLinkedQueue)4 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)4 ByteString (com.google.protobuf.ByteString)3 Attributes (io.grpc.Attributes)3 EquivalentAddressGroup (io.grpc.EquivalentAddressGroup)3 ResolvedServerInfoGroup (io.grpc.ResolvedServerInfoGroup)3 MockClientTransportInfo (io.grpc.internal.TestUtils.MockClientTransportInfo)3 ByteBuf (io.netty.buffer.ByteBuf)3 VisibleForTesting (com.google.common.annotations.VisibleForTesting)2 ClientCall (io.grpc.ClientCall)2