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.internal; 18 19 import io.grpc.ClientCall; 20 import io.grpc.Metadata; 21 22 /** 23 * {@link NoopClientCall} is a class that is designed for use in tests. It is designed to be used 24 * in places where a scriptable call is necessary. By default, all methods are noops, and designed 25 * to be overridden. 26 */ 27 public class NoopClientCall<ReqT, RespT> extends ClientCall<ReqT, RespT> { 28 29 /** 30 * {@link NoopClientCall.NoopClientCallListener} is a class that is designed for use in tests. 31 * It is designed to be used in places where a scriptable call listener is necessary. By 32 * default, all methods are noops, and designed to be overridden. 33 */ 34 public static class NoopClientCallListener<T> extends ClientCall.Listener<T> { 35 } 36 37 @Override start(ClientCall.Listener<RespT> listener, Metadata headers)38 public void start(ClientCall.Listener<RespT> listener, Metadata headers) {} 39 40 @Override request(int numMessages)41 public void request(int numMessages) {} 42 43 @Override cancel(String message, Throwable cause)44 public void cancel(String message, Throwable cause) {} 45 46 @Override halfClose()47 public void halfClose() {} 48 49 @Override sendMessage(ReqT message)50 public void sendMessage(ReqT message) {} 51 } 52