• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2014 The gRPC Authors
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package io.grpc.testing.integration;
18 
19 import io.grpc.ManagedChannel;
20 import io.grpc.internal.AbstractServerImplBuilder;
21 import io.grpc.netty.NegotiationType;
22 import io.grpc.netty.NettyChannelBuilder;
23 import io.grpc.netty.NettyServerBuilder;
24 import io.netty.channel.local.LocalAddress;
25 import io.netty.channel.local.LocalChannel;
26 import io.netty.channel.local.LocalServerChannel;
27 import org.junit.runner.RunWith;
28 import org.junit.runners.JUnit4;
29 
30 /**
31  * Run transport tests over the Netty in-process channel.
32  */
33 @RunWith(JUnit4.class)
34 public class Http2NettyLocalChannelTest extends AbstractInteropTest {
35 
36   @Override
getServerBuilder()37   protected AbstractServerImplBuilder<?> getServerBuilder() {
38     return NettyServerBuilder
39         .forAddress(new LocalAddress("in-process-1"))
40         .flowControlWindow(65 * 1024)
41         .maxInboundMessageSize(AbstractInteropTest.MAX_MESSAGE_SIZE)
42         .channelType(LocalServerChannel.class);
43   }
44 
45   @Override
createChannel()46   protected ManagedChannel createChannel() {
47     NettyChannelBuilder builder = NettyChannelBuilder
48         .forAddress(new LocalAddress("in-process-1"))
49         .negotiationType(NegotiationType.PLAINTEXT)
50         .channelType(LocalChannel.class)
51         .flowControlWindow(65 * 1024)
52         .maxInboundMessageSize(AbstractInteropTest.MAX_MESSAGE_SIZE);
53     io.grpc.internal.TestingAccessor.setStatsImplementation(
54         builder, createClientCensusStatsModule());
55     return builder.build();
56   }
57 }
58