• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2016 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.InsecureServerCredentials;
20 import io.grpc.ServerBuilder;
21 import io.grpc.netty.InternalNettyChannelBuilder;
22 import io.grpc.netty.InternalNettyServerBuilder;
23 import io.grpc.netty.NegotiationType;
24 import io.grpc.netty.NettyChannelBuilder;
25 import io.grpc.netty.NettyServerBuilder;
26 import org.junit.runner.RunWith;
27 import org.junit.runners.JUnit4;
28 
29 @RunWith(JUnit4.class)
30 public class AutoWindowSizingOnTest extends AbstractInteropTest {
31 
32   @Override
getServerBuilder()33   protected ServerBuilder<?> getServerBuilder() {
34     NettyServerBuilder builder = NettyServerBuilder.forPort(0, InsecureServerCredentials.create())
35         .maxInboundMessageSize(AbstractInteropTest.MAX_MESSAGE_SIZE);
36     // Disable the default census stats tracer, use testing tracer instead.
37     InternalNettyServerBuilder.setStatsEnabled(builder, false);
38     return builder.addStreamTracerFactory(createCustomCensusTracerFactory());
39   }
40 
41   @Override
createChannelBuilder()42   protected NettyChannelBuilder createChannelBuilder() {
43     NettyChannelBuilder builder = NettyChannelBuilder.forAddress(getListenAddress())
44         .negotiationType(NegotiationType.PLAINTEXT)
45         .maxInboundMessageSize(AbstractInteropTest.MAX_MESSAGE_SIZE)
46         .initialFlowControlWindow(NettyChannelBuilder.DEFAULT_FLOW_CONTROL_WINDOW);
47     // Disable the default census stats interceptor, use testing interceptor instead.
48     InternalNettyChannelBuilder.setStatsEnabled(builder, false);
49     return builder.intercept(createCensusStatsClientInterceptor());
50   }
51 }
52