1package io.grpc.testing.compiler.nano;
2
3import static io.grpc.MethodDescriptor.generateFullMethodName;
4import static io.grpc.stub.ClientCalls.asyncBidiStreamingCall;
5import static io.grpc.stub.ClientCalls.asyncClientStreamingCall;
6import static io.grpc.stub.ClientCalls.asyncServerStreamingCall;
7import static io.grpc.stub.ClientCalls.asyncUnaryCall;
8import static io.grpc.stub.ClientCalls.blockingServerStreamingCall;
9import static io.grpc.stub.ClientCalls.blockingUnaryCall;
10import static io.grpc.stub.ClientCalls.futureUnaryCall;
11import static io.grpc.stub.ServerCalls.asyncBidiStreamingCall;
12import static io.grpc.stub.ServerCalls.asyncClientStreamingCall;
13import static io.grpc.stub.ServerCalls.asyncServerStreamingCall;
14import static io.grpc.stub.ServerCalls.asyncUnaryCall;
15import static io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall;
16import static io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall;
17
18import java.io.IOException;
19
20/**
21 * <pre>
22 * Test service that supports all call types.
23 * </pre>
24 */
25@javax.annotation.Generated(
26    value = "by gRPC proto compiler (version 1.16.0-SNAPSHOT)",
27    comments = "Source: grpc/testing/compiler/test.proto")
28public final class TestServiceGrpc {
29
30  private TestServiceGrpc() {}
31
32  public static final String SERVICE_NAME = "grpc.testing.compiler.TestService";
33
34  // Static method descriptors that strictly reflect the proto.
35  private static final int ARG_IN_METHOD_UNARY_CALL = 0;
36  private static final int ARG_OUT_METHOD_UNARY_CALL = 1;
37  private static volatile io.grpc.MethodDescriptor<io.grpc.testing.compiler.nano.Test.SimpleRequest,
38      io.grpc.testing.compiler.nano.Test.SimpleResponse> getUnaryCallMethod;
39
40  public static io.grpc.MethodDescriptor<io.grpc.testing.compiler.nano.Test.SimpleRequest,
41      io.grpc.testing.compiler.nano.Test.SimpleResponse> getUnaryCallMethod() {
42    io.grpc.MethodDescriptor<io.grpc.testing.compiler.nano.Test.SimpleRequest, io.grpc.testing.compiler.nano.Test.SimpleResponse> getUnaryCallMethod;
43    if ((getUnaryCallMethod = TestServiceGrpc.getUnaryCallMethod) == null) {
44      synchronized (TestServiceGrpc.class) {
45        if ((getUnaryCallMethod = TestServiceGrpc.getUnaryCallMethod) == null) {
46          TestServiceGrpc.getUnaryCallMethod = getUnaryCallMethod =
47              io.grpc.MethodDescriptor.<io.grpc.testing.compiler.nano.Test.SimpleRequest, io.grpc.testing.compiler.nano.Test.SimpleResponse>newBuilder()
48              .setType(io.grpc.MethodDescriptor.MethodType.UNARY)
49              .setFullMethodName(generateFullMethodName(
50                  "grpc.testing.compiler.TestService", "UnaryCall"))
51              .setSampledToLocalTracing(true)
52              .setRequestMarshaller(io.grpc.protobuf.nano.NanoUtils.<io.grpc.testing.compiler.nano.Test.SimpleRequest>marshaller(
53                  new NanoFactory<io.grpc.testing.compiler.nano.Test.SimpleRequest>(ARG_IN_METHOD_UNARY_CALL)))
54              .setResponseMarshaller(io.grpc.protobuf.nano.NanoUtils.<io.grpc.testing.compiler.nano.Test.SimpleResponse>marshaller(
55                  new NanoFactory<io.grpc.testing.compiler.nano.Test.SimpleResponse>(ARG_OUT_METHOD_UNARY_CALL)))
56              .build();
57        }
58      }
59    }
60    return getUnaryCallMethod;
61  }
62
63  private static final int ARG_IN_METHOD_STREAMING_OUTPUT_CALL = 2;
64  private static final int ARG_OUT_METHOD_STREAMING_OUTPUT_CALL = 3;
65  private static volatile io.grpc.MethodDescriptor<io.grpc.testing.compiler.nano.Test.StreamingOutputCallRequest,
66      io.grpc.testing.compiler.nano.Test.StreamingOutputCallResponse> getStreamingOutputCallMethod;
67
68  public static io.grpc.MethodDescriptor<io.grpc.testing.compiler.nano.Test.StreamingOutputCallRequest,
69      io.grpc.testing.compiler.nano.Test.StreamingOutputCallResponse> getStreamingOutputCallMethod() {
70    io.grpc.MethodDescriptor<io.grpc.testing.compiler.nano.Test.StreamingOutputCallRequest, io.grpc.testing.compiler.nano.Test.StreamingOutputCallResponse> getStreamingOutputCallMethod;
71    if ((getStreamingOutputCallMethod = TestServiceGrpc.getStreamingOutputCallMethod) == null) {
72      synchronized (TestServiceGrpc.class) {
73        if ((getStreamingOutputCallMethod = TestServiceGrpc.getStreamingOutputCallMethod) == null) {
74          TestServiceGrpc.getStreamingOutputCallMethod = getStreamingOutputCallMethod =
75              io.grpc.MethodDescriptor.<io.grpc.testing.compiler.nano.Test.StreamingOutputCallRequest, io.grpc.testing.compiler.nano.Test.StreamingOutputCallResponse>newBuilder()
76              .setType(io.grpc.MethodDescriptor.MethodType.SERVER_STREAMING)
77              .setFullMethodName(generateFullMethodName(
78                  "grpc.testing.compiler.TestService", "StreamingOutputCall"))
79              .setSampledToLocalTracing(true)
80              .setRequestMarshaller(io.grpc.protobuf.nano.NanoUtils.<io.grpc.testing.compiler.nano.Test.StreamingOutputCallRequest>marshaller(
81                  new NanoFactory<io.grpc.testing.compiler.nano.Test.StreamingOutputCallRequest>(ARG_IN_METHOD_STREAMING_OUTPUT_CALL)))
82              .setResponseMarshaller(io.grpc.protobuf.nano.NanoUtils.<io.grpc.testing.compiler.nano.Test.StreamingOutputCallResponse>marshaller(
83                  new NanoFactory<io.grpc.testing.compiler.nano.Test.StreamingOutputCallResponse>(ARG_OUT_METHOD_STREAMING_OUTPUT_CALL)))
84              .build();
85        }
86      }
87    }
88    return getStreamingOutputCallMethod;
89  }
90
91  private static final int ARG_IN_METHOD_STREAMING_INPUT_CALL = 4;
92  private static final int ARG_OUT_METHOD_STREAMING_INPUT_CALL = 5;
93  private static volatile io.grpc.MethodDescriptor<io.grpc.testing.compiler.nano.Test.StreamingInputCallRequest,
94      io.grpc.testing.compiler.nano.Test.StreamingInputCallResponse> getStreamingInputCallMethod;
95
96  public static io.grpc.MethodDescriptor<io.grpc.testing.compiler.nano.Test.StreamingInputCallRequest,
97      io.grpc.testing.compiler.nano.Test.StreamingInputCallResponse> getStreamingInputCallMethod() {
98    io.grpc.MethodDescriptor<io.grpc.testing.compiler.nano.Test.StreamingInputCallRequest, io.grpc.testing.compiler.nano.Test.StreamingInputCallResponse> getStreamingInputCallMethod;
99    if ((getStreamingInputCallMethod = TestServiceGrpc.getStreamingInputCallMethod) == null) {
100      synchronized (TestServiceGrpc.class) {
101        if ((getStreamingInputCallMethod = TestServiceGrpc.getStreamingInputCallMethod) == null) {
102          TestServiceGrpc.getStreamingInputCallMethod = getStreamingInputCallMethod =
103              io.grpc.MethodDescriptor.<io.grpc.testing.compiler.nano.Test.StreamingInputCallRequest, io.grpc.testing.compiler.nano.Test.StreamingInputCallResponse>newBuilder()
104              .setType(io.grpc.MethodDescriptor.MethodType.CLIENT_STREAMING)
105              .setFullMethodName(generateFullMethodName(
106                  "grpc.testing.compiler.TestService", "StreamingInputCall"))
107              .setSampledToLocalTracing(true)
108              .setRequestMarshaller(io.grpc.protobuf.nano.NanoUtils.<io.grpc.testing.compiler.nano.Test.StreamingInputCallRequest>marshaller(
109                  new NanoFactory<io.grpc.testing.compiler.nano.Test.StreamingInputCallRequest>(ARG_IN_METHOD_STREAMING_INPUT_CALL)))
110              .setResponseMarshaller(io.grpc.protobuf.nano.NanoUtils.<io.grpc.testing.compiler.nano.Test.StreamingInputCallResponse>marshaller(
111                  new NanoFactory<io.grpc.testing.compiler.nano.Test.StreamingInputCallResponse>(ARG_OUT_METHOD_STREAMING_INPUT_CALL)))
112              .build();
113        }
114      }
115    }
116    return getStreamingInputCallMethod;
117  }
118
119  private static final int ARG_IN_METHOD_FULL_BIDI_CALL = 6;
120  private static final int ARG_OUT_METHOD_FULL_BIDI_CALL = 7;
121  private static volatile io.grpc.MethodDescriptor<io.grpc.testing.compiler.nano.Test.StreamingOutputCallRequest,
122      io.grpc.testing.compiler.nano.Test.StreamingOutputCallResponse> getFullBidiCallMethod;
123
124  public static io.grpc.MethodDescriptor<io.grpc.testing.compiler.nano.Test.StreamingOutputCallRequest,
125      io.grpc.testing.compiler.nano.Test.StreamingOutputCallResponse> getFullBidiCallMethod() {
126    io.grpc.MethodDescriptor<io.grpc.testing.compiler.nano.Test.StreamingOutputCallRequest, io.grpc.testing.compiler.nano.Test.StreamingOutputCallResponse> getFullBidiCallMethod;
127    if ((getFullBidiCallMethod = TestServiceGrpc.getFullBidiCallMethod) == null) {
128      synchronized (TestServiceGrpc.class) {
129        if ((getFullBidiCallMethod = TestServiceGrpc.getFullBidiCallMethod) == null) {
130          TestServiceGrpc.getFullBidiCallMethod = getFullBidiCallMethod =
131              io.grpc.MethodDescriptor.<io.grpc.testing.compiler.nano.Test.StreamingOutputCallRequest, io.grpc.testing.compiler.nano.Test.StreamingOutputCallResponse>newBuilder()
132              .setType(io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING)
133              .setFullMethodName(generateFullMethodName(
134                  "grpc.testing.compiler.TestService", "FullBidiCall"))
135              .setSampledToLocalTracing(true)
136              .setRequestMarshaller(io.grpc.protobuf.nano.NanoUtils.<io.grpc.testing.compiler.nano.Test.StreamingOutputCallRequest>marshaller(
137                  new NanoFactory<io.grpc.testing.compiler.nano.Test.StreamingOutputCallRequest>(ARG_IN_METHOD_FULL_BIDI_CALL)))
138              .setResponseMarshaller(io.grpc.protobuf.nano.NanoUtils.<io.grpc.testing.compiler.nano.Test.StreamingOutputCallResponse>marshaller(
139                  new NanoFactory<io.grpc.testing.compiler.nano.Test.StreamingOutputCallResponse>(ARG_OUT_METHOD_FULL_BIDI_CALL)))
140              .build();
141        }
142      }
143    }
144    return getFullBidiCallMethod;
145  }
146
147  private static final int ARG_IN_METHOD_HALF_BIDI_CALL = 8;
148  private static final int ARG_OUT_METHOD_HALF_BIDI_CALL = 9;
149  private static volatile io.grpc.MethodDescriptor<io.grpc.testing.compiler.nano.Test.StreamingOutputCallRequest,
150      io.grpc.testing.compiler.nano.Test.StreamingOutputCallResponse> getHalfBidiCallMethod;
151
152  public static io.grpc.MethodDescriptor<io.grpc.testing.compiler.nano.Test.StreamingOutputCallRequest,
153      io.grpc.testing.compiler.nano.Test.StreamingOutputCallResponse> getHalfBidiCallMethod() {
154    io.grpc.MethodDescriptor<io.grpc.testing.compiler.nano.Test.StreamingOutputCallRequest, io.grpc.testing.compiler.nano.Test.StreamingOutputCallResponse> getHalfBidiCallMethod;
155    if ((getHalfBidiCallMethod = TestServiceGrpc.getHalfBidiCallMethod) == null) {
156      synchronized (TestServiceGrpc.class) {
157        if ((getHalfBidiCallMethod = TestServiceGrpc.getHalfBidiCallMethod) == null) {
158          TestServiceGrpc.getHalfBidiCallMethod = getHalfBidiCallMethod =
159              io.grpc.MethodDescriptor.<io.grpc.testing.compiler.nano.Test.StreamingOutputCallRequest, io.grpc.testing.compiler.nano.Test.StreamingOutputCallResponse>newBuilder()
160              .setType(io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING)
161              .setFullMethodName(generateFullMethodName(
162                  "grpc.testing.compiler.TestService", "HalfBidiCall"))
163              .setSampledToLocalTracing(true)
164              .setRequestMarshaller(io.grpc.protobuf.nano.NanoUtils.<io.grpc.testing.compiler.nano.Test.StreamingOutputCallRequest>marshaller(
165                  new NanoFactory<io.grpc.testing.compiler.nano.Test.StreamingOutputCallRequest>(ARG_IN_METHOD_HALF_BIDI_CALL)))
166              .setResponseMarshaller(io.grpc.protobuf.nano.NanoUtils.<io.grpc.testing.compiler.nano.Test.StreamingOutputCallResponse>marshaller(
167                  new NanoFactory<io.grpc.testing.compiler.nano.Test.StreamingOutputCallResponse>(ARG_OUT_METHOD_HALF_BIDI_CALL)))
168              .build();
169        }
170      }
171    }
172    return getHalfBidiCallMethod;
173  }
174
175  private static final int ARG_IN_METHOD_IMPORT = 10;
176  private static final int ARG_OUT_METHOD_IMPORT = 11;
177  private static volatile io.grpc.MethodDescriptor<io.grpc.testing.compiler.nano.Test.StreamingInputCallRequest,
178      io.grpc.testing.compiler.nano.Test.StreamingInputCallResponse> getImportMethod;
179
180  public static io.grpc.MethodDescriptor<io.grpc.testing.compiler.nano.Test.StreamingInputCallRequest,
181      io.grpc.testing.compiler.nano.Test.StreamingInputCallResponse> getImportMethod() {
182    io.grpc.MethodDescriptor<io.grpc.testing.compiler.nano.Test.StreamingInputCallRequest, io.grpc.testing.compiler.nano.Test.StreamingInputCallResponse> getImportMethod;
183    if ((getImportMethod = TestServiceGrpc.getImportMethod) == null) {
184      synchronized (TestServiceGrpc.class) {
185        if ((getImportMethod = TestServiceGrpc.getImportMethod) == null) {
186          TestServiceGrpc.getImportMethod = getImportMethod =
187              io.grpc.MethodDescriptor.<io.grpc.testing.compiler.nano.Test.StreamingInputCallRequest, io.grpc.testing.compiler.nano.Test.StreamingInputCallResponse>newBuilder()
188              .setType(io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING)
189              .setFullMethodName(generateFullMethodName(
190                  "grpc.testing.compiler.TestService", "Import"))
191              .setSampledToLocalTracing(true)
192              .setRequestMarshaller(io.grpc.protobuf.nano.NanoUtils.<io.grpc.testing.compiler.nano.Test.StreamingInputCallRequest>marshaller(
193                  new NanoFactory<io.grpc.testing.compiler.nano.Test.StreamingInputCallRequest>(ARG_IN_METHOD_IMPORT)))
194              .setResponseMarshaller(io.grpc.protobuf.nano.NanoUtils.<io.grpc.testing.compiler.nano.Test.StreamingInputCallResponse>marshaller(
195                  new NanoFactory<io.grpc.testing.compiler.nano.Test.StreamingInputCallResponse>(ARG_OUT_METHOD_IMPORT)))
196              .build();
197        }
198      }
199    }
200    return getImportMethod;
201  }
202
203  private static final class NanoFactory<T extends com.google.protobuf.nano.MessageNano>
204      implements io.grpc.protobuf.nano.MessageNanoFactory<T> {
205    private final int id;
206
207    NanoFactory(int id) {
208      this.id = id;
209    }
210
211    @java.lang.Override
212    public T newInstance() {
213      Object o;
214      switch (id) {
215      case ARG_IN_METHOD_UNARY_CALL:
216        o = new io.grpc.testing.compiler.nano.Test.SimpleRequest();
217        break;
218      case ARG_OUT_METHOD_UNARY_CALL:
219        o = new io.grpc.testing.compiler.nano.Test.SimpleResponse();
220        break;
221      case ARG_IN_METHOD_STREAMING_OUTPUT_CALL:
222        o = new io.grpc.testing.compiler.nano.Test.StreamingOutputCallRequest();
223        break;
224      case ARG_OUT_METHOD_STREAMING_OUTPUT_CALL:
225        o = new io.grpc.testing.compiler.nano.Test.StreamingOutputCallResponse();
226        break;
227      case ARG_IN_METHOD_STREAMING_INPUT_CALL:
228        o = new io.grpc.testing.compiler.nano.Test.StreamingInputCallRequest();
229        break;
230      case ARG_OUT_METHOD_STREAMING_INPUT_CALL:
231        o = new io.grpc.testing.compiler.nano.Test.StreamingInputCallResponse();
232        break;
233      case ARG_IN_METHOD_FULL_BIDI_CALL:
234        o = new io.grpc.testing.compiler.nano.Test.StreamingOutputCallRequest();
235        break;
236      case ARG_OUT_METHOD_FULL_BIDI_CALL:
237        o = new io.grpc.testing.compiler.nano.Test.StreamingOutputCallResponse();
238        break;
239      case ARG_IN_METHOD_HALF_BIDI_CALL:
240        o = new io.grpc.testing.compiler.nano.Test.StreamingOutputCallRequest();
241        break;
242      case ARG_OUT_METHOD_HALF_BIDI_CALL:
243        o = new io.grpc.testing.compiler.nano.Test.StreamingOutputCallResponse();
244        break;
245      case ARG_IN_METHOD_IMPORT:
246        o = new io.grpc.testing.compiler.nano.Test.StreamingInputCallRequest();
247        break;
248      case ARG_OUT_METHOD_IMPORT:
249        o = new io.grpc.testing.compiler.nano.Test.StreamingInputCallResponse();
250        break;
251      default:
252        throw new AssertionError();
253      }
254      @java.lang.SuppressWarnings("unchecked")
255      T t = (T) o;
256      return t;
257    }
258  }
259
260  /**
261   * Creates a new async stub that supports all call types for the service
262   */
263  public static TestServiceStub newStub(io.grpc.Channel channel) {
264    return new TestServiceStub(channel);
265  }
266
267  /**
268   * Creates a new blocking-style stub that supports unary and streaming output calls on the service
269   */
270  public static TestServiceBlockingStub newBlockingStub(
271      io.grpc.Channel channel) {
272    return new TestServiceBlockingStub(channel);
273  }
274
275  /**
276   * Creates a new ListenableFuture-style stub that supports unary calls on the service
277   */
278  public static TestServiceFutureStub newFutureStub(
279      io.grpc.Channel channel) {
280    return new TestServiceFutureStub(channel);
281  }
282
283  /**
284   * <pre>
285   * Test service that supports all call types.
286   * </pre>
287   */
288  public static abstract class TestServiceImplBase implements io.grpc.BindableService {
289
290    /**
291     * <pre>
292     * One request followed by one response.
293     * The server returns the client payload as-is.
294     * </pre>
295     */
296    public void unaryCall(io.grpc.testing.compiler.nano.Test.SimpleRequest request,
297        io.grpc.stub.StreamObserver<io.grpc.testing.compiler.nano.Test.SimpleResponse> responseObserver) {
298      asyncUnimplementedUnaryCall(getUnaryCallMethod(), responseObserver);
299    }
300
301    /**
302     * <pre>
303     * One request followed by a sequence of responses (streamed download).
304     * The server returns the payload with client desired type and sizes.
305     * </pre>
306     */
307    public void streamingOutputCall(io.grpc.testing.compiler.nano.Test.StreamingOutputCallRequest request,
308        io.grpc.stub.StreamObserver<io.grpc.testing.compiler.nano.Test.StreamingOutputCallResponse> responseObserver) {
309      asyncUnimplementedUnaryCall(getStreamingOutputCallMethod(), responseObserver);
310    }
311
312    /**
313     * <pre>
314     * A sequence of requests followed by one response (streamed upload).
315     * The server returns the aggregated size of client payload as the result.
316     * </pre>
317     */
318    public io.grpc.stub.StreamObserver<io.grpc.testing.compiler.nano.Test.StreamingInputCallRequest> streamingInputCall(
319        io.grpc.stub.StreamObserver<io.grpc.testing.compiler.nano.Test.StreamingInputCallResponse> responseObserver) {
320      return asyncUnimplementedStreamingCall(getStreamingInputCallMethod(), responseObserver);
321    }
322
323    /**
324     * <pre>
325     * A sequence of requests with each request served by the server immediately.
326     * As one request could lead to multiple responses, this interface
327     * demonstrates the idea of full bidirectionality.
328     * </pre>
329     */
330    public io.grpc.stub.StreamObserver<io.grpc.testing.compiler.nano.Test.StreamingOutputCallRequest> fullBidiCall(
331        io.grpc.stub.StreamObserver<io.grpc.testing.compiler.nano.Test.StreamingOutputCallResponse> responseObserver) {
332      return asyncUnimplementedStreamingCall(getFullBidiCallMethod(), responseObserver);
333    }
334
335    /**
336     * <pre>
337     * A sequence of requests followed by a sequence of responses.
338     * The server buffers all the client requests and then serves them in order. A
339     * stream of responses are returned to the client when the server starts with
340     * first request.
341     * </pre>
342     */
343    public io.grpc.stub.StreamObserver<io.grpc.testing.compiler.nano.Test.StreamingOutputCallRequest> halfBidiCall(
344        io.grpc.stub.StreamObserver<io.grpc.testing.compiler.nano.Test.StreamingOutputCallResponse> responseObserver) {
345      return asyncUnimplementedStreamingCall(getHalfBidiCallMethod(), responseObserver);
346    }
347
348    /**
349     * <pre>
350     * An RPC method whose Java name collides with a keyword, and whose generated
351     * method should have a '_' appended.
352     * </pre>
353     */
354    public io.grpc.stub.StreamObserver<io.grpc.testing.compiler.nano.Test.StreamingInputCallRequest> import_(
355        io.grpc.stub.StreamObserver<io.grpc.testing.compiler.nano.Test.StreamingInputCallResponse> responseObserver) {
356      return asyncUnimplementedStreamingCall(getImportMethod(), responseObserver);
357    }
358
359    @java.lang.Override public final io.grpc.ServerServiceDefinition bindService() {
360      return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
361          .addMethod(
362            getUnaryCallMethod(),
363            asyncUnaryCall(
364              new MethodHandlers<
365                io.grpc.testing.compiler.nano.Test.SimpleRequest,
366                io.grpc.testing.compiler.nano.Test.SimpleResponse>(
367                  this, METHODID_UNARY_CALL)))
368          .addMethod(
369            getStreamingOutputCallMethod(),
370            asyncServerStreamingCall(
371              new MethodHandlers<
372                io.grpc.testing.compiler.nano.Test.StreamingOutputCallRequest,
373                io.grpc.testing.compiler.nano.Test.StreamingOutputCallResponse>(
374                  this, METHODID_STREAMING_OUTPUT_CALL)))
375          .addMethod(
376            getStreamingInputCallMethod(),
377            asyncClientStreamingCall(
378              new MethodHandlers<
379                io.grpc.testing.compiler.nano.Test.StreamingInputCallRequest,
380                io.grpc.testing.compiler.nano.Test.StreamingInputCallResponse>(
381                  this, METHODID_STREAMING_INPUT_CALL)))
382          .addMethod(
383            getFullBidiCallMethod(),
384            asyncBidiStreamingCall(
385              new MethodHandlers<
386                io.grpc.testing.compiler.nano.Test.StreamingOutputCallRequest,
387                io.grpc.testing.compiler.nano.Test.StreamingOutputCallResponse>(
388                  this, METHODID_FULL_BIDI_CALL)))
389          .addMethod(
390            getHalfBidiCallMethod(),
391            asyncBidiStreamingCall(
392              new MethodHandlers<
393                io.grpc.testing.compiler.nano.Test.StreamingOutputCallRequest,
394                io.grpc.testing.compiler.nano.Test.StreamingOutputCallResponse>(
395                  this, METHODID_HALF_BIDI_CALL)))
396          .addMethod(
397            getImportMethod(),
398            asyncBidiStreamingCall(
399              new MethodHandlers<
400                io.grpc.testing.compiler.nano.Test.StreamingInputCallRequest,
401                io.grpc.testing.compiler.nano.Test.StreamingInputCallResponse>(
402                  this, METHODID_IMPORT)))
403          .build();
404    }
405  }
406
407  /**
408   * <pre>
409   * Test service that supports all call types.
410   * </pre>
411   */
412  public static final class TestServiceStub extends io.grpc.stub.AbstractStub<TestServiceStub> {
413    private TestServiceStub(io.grpc.Channel channel) {
414      super(channel);
415    }
416
417    private TestServiceStub(io.grpc.Channel channel,
418        io.grpc.CallOptions callOptions) {
419      super(channel, callOptions);
420    }
421
422    @java.lang.Override
423    protected TestServiceStub build(io.grpc.Channel channel,
424        io.grpc.CallOptions callOptions) {
425      return new TestServiceStub(channel, callOptions);
426    }
427
428    /**
429     * <pre>
430     * One request followed by one response.
431     * The server returns the client payload as-is.
432     * </pre>
433     */
434    public void unaryCall(io.grpc.testing.compiler.nano.Test.SimpleRequest request,
435        io.grpc.stub.StreamObserver<io.grpc.testing.compiler.nano.Test.SimpleResponse> responseObserver) {
436      asyncUnaryCall(
437          getChannel().newCall(getUnaryCallMethod(), getCallOptions()), request, responseObserver);
438    }
439
440    /**
441     * <pre>
442     * One request followed by a sequence of responses (streamed download).
443     * The server returns the payload with client desired type and sizes.
444     * </pre>
445     */
446    public void streamingOutputCall(io.grpc.testing.compiler.nano.Test.StreamingOutputCallRequest request,
447        io.grpc.stub.StreamObserver<io.grpc.testing.compiler.nano.Test.StreamingOutputCallResponse> responseObserver) {
448      asyncServerStreamingCall(
449          getChannel().newCall(getStreamingOutputCallMethod(), getCallOptions()), request, responseObserver);
450    }
451
452    /**
453     * <pre>
454     * A sequence of requests followed by one response (streamed upload).
455     * The server returns the aggregated size of client payload as the result.
456     * </pre>
457     */
458    public io.grpc.stub.StreamObserver<io.grpc.testing.compiler.nano.Test.StreamingInputCallRequest> streamingInputCall(
459        io.grpc.stub.StreamObserver<io.grpc.testing.compiler.nano.Test.StreamingInputCallResponse> responseObserver) {
460      return asyncClientStreamingCall(
461          getChannel().newCall(getStreamingInputCallMethod(), getCallOptions()), responseObserver);
462    }
463
464    /**
465     * <pre>
466     * A sequence of requests with each request served by the server immediately.
467     * As one request could lead to multiple responses, this interface
468     * demonstrates the idea of full bidirectionality.
469     * </pre>
470     */
471    public io.grpc.stub.StreamObserver<io.grpc.testing.compiler.nano.Test.StreamingOutputCallRequest> fullBidiCall(
472        io.grpc.stub.StreamObserver<io.grpc.testing.compiler.nano.Test.StreamingOutputCallResponse> responseObserver) {
473      return asyncBidiStreamingCall(
474          getChannel().newCall(getFullBidiCallMethod(), getCallOptions()), responseObserver);
475    }
476
477    /**
478     * <pre>
479     * A sequence of requests followed by a sequence of responses.
480     * The server buffers all the client requests and then serves them in order. A
481     * stream of responses are returned to the client when the server starts with
482     * first request.
483     * </pre>
484     */
485    public io.grpc.stub.StreamObserver<io.grpc.testing.compiler.nano.Test.StreamingOutputCallRequest> halfBidiCall(
486        io.grpc.stub.StreamObserver<io.grpc.testing.compiler.nano.Test.StreamingOutputCallResponse> responseObserver) {
487      return asyncBidiStreamingCall(
488          getChannel().newCall(getHalfBidiCallMethod(), getCallOptions()), responseObserver);
489    }
490
491    /**
492     * <pre>
493     * An RPC method whose Java name collides with a keyword, and whose generated
494     * method should have a '_' appended.
495     * </pre>
496     */
497    public io.grpc.stub.StreamObserver<io.grpc.testing.compiler.nano.Test.StreamingInputCallRequest> import_(
498        io.grpc.stub.StreamObserver<io.grpc.testing.compiler.nano.Test.StreamingInputCallResponse> responseObserver) {
499      return asyncBidiStreamingCall(
500          getChannel().newCall(getImportMethod(), getCallOptions()), responseObserver);
501    }
502  }
503
504  /**
505   * <pre>
506   * Test service that supports all call types.
507   * </pre>
508   */
509  public static final class TestServiceBlockingStub extends io.grpc.stub.AbstractStub<TestServiceBlockingStub> {
510    private TestServiceBlockingStub(io.grpc.Channel channel) {
511      super(channel);
512    }
513
514    private TestServiceBlockingStub(io.grpc.Channel channel,
515        io.grpc.CallOptions callOptions) {
516      super(channel, callOptions);
517    }
518
519    @java.lang.Override
520    protected TestServiceBlockingStub build(io.grpc.Channel channel,
521        io.grpc.CallOptions callOptions) {
522      return new TestServiceBlockingStub(channel, callOptions);
523    }
524
525    /**
526     * <pre>
527     * One request followed by one response.
528     * The server returns the client payload as-is.
529     * </pre>
530     */
531    public io.grpc.testing.compiler.nano.Test.SimpleResponse unaryCall(io.grpc.testing.compiler.nano.Test.SimpleRequest request) {
532      return blockingUnaryCall(
533          getChannel(), getUnaryCallMethod(), getCallOptions(), request);
534    }
535
536    /**
537     * <pre>
538     * One request followed by a sequence of responses (streamed download).
539     * The server returns the payload with client desired type and sizes.
540     * </pre>
541     */
542    public java.util.Iterator<io.grpc.testing.compiler.nano.Test.StreamingOutputCallResponse> streamingOutputCall(
543        io.grpc.testing.compiler.nano.Test.StreamingOutputCallRequest request) {
544      return blockingServerStreamingCall(
545          getChannel(), getStreamingOutputCallMethod(), getCallOptions(), request);
546    }
547  }
548
549  /**
550   * <pre>
551   * Test service that supports all call types.
552   * </pre>
553   */
554  public static final class TestServiceFutureStub extends io.grpc.stub.AbstractStub<TestServiceFutureStub> {
555    private TestServiceFutureStub(io.grpc.Channel channel) {
556      super(channel);
557    }
558
559    private TestServiceFutureStub(io.grpc.Channel channel,
560        io.grpc.CallOptions callOptions) {
561      super(channel, callOptions);
562    }
563
564    @java.lang.Override
565    protected TestServiceFutureStub build(io.grpc.Channel channel,
566        io.grpc.CallOptions callOptions) {
567      return new TestServiceFutureStub(channel, callOptions);
568    }
569
570    /**
571     * <pre>
572     * One request followed by one response.
573     * The server returns the client payload as-is.
574     * </pre>
575     */
576    public com.google.common.util.concurrent.ListenableFuture<io.grpc.testing.compiler.nano.Test.SimpleResponse> unaryCall(
577        io.grpc.testing.compiler.nano.Test.SimpleRequest request) {
578      return futureUnaryCall(
579          getChannel().newCall(getUnaryCallMethod(), getCallOptions()), request);
580    }
581  }
582
583  private static final int METHODID_UNARY_CALL = 0;
584  private static final int METHODID_STREAMING_OUTPUT_CALL = 1;
585  private static final int METHODID_STREAMING_INPUT_CALL = 2;
586  private static final int METHODID_FULL_BIDI_CALL = 3;
587  private static final int METHODID_HALF_BIDI_CALL = 4;
588  private static final int METHODID_IMPORT = 5;
589
590  private static final class MethodHandlers<Req, Resp> implements
591      io.grpc.stub.ServerCalls.UnaryMethod<Req, Resp>,
592      io.grpc.stub.ServerCalls.ServerStreamingMethod<Req, Resp>,
593      io.grpc.stub.ServerCalls.ClientStreamingMethod<Req, Resp>,
594      io.grpc.stub.ServerCalls.BidiStreamingMethod<Req, Resp> {
595    private final TestServiceImplBase serviceImpl;
596    private final int methodId;
597
598    MethodHandlers(TestServiceImplBase serviceImpl, int methodId) {
599      this.serviceImpl = serviceImpl;
600      this.methodId = methodId;
601    }
602
603    @java.lang.Override
604    @java.lang.SuppressWarnings("unchecked")
605    public void invoke(Req request, io.grpc.stub.StreamObserver<Resp> responseObserver) {
606      switch (methodId) {
607        case METHODID_UNARY_CALL:
608          serviceImpl.unaryCall((io.grpc.testing.compiler.nano.Test.SimpleRequest) request,
609              (io.grpc.stub.StreamObserver<io.grpc.testing.compiler.nano.Test.SimpleResponse>) responseObserver);
610          break;
611        case METHODID_STREAMING_OUTPUT_CALL:
612          serviceImpl.streamingOutputCall((io.grpc.testing.compiler.nano.Test.StreamingOutputCallRequest) request,
613              (io.grpc.stub.StreamObserver<io.grpc.testing.compiler.nano.Test.StreamingOutputCallResponse>) responseObserver);
614          break;
615        default:
616          throw new AssertionError();
617      }
618    }
619
620    @java.lang.Override
621    @java.lang.SuppressWarnings("unchecked")
622    public io.grpc.stub.StreamObserver<Req> invoke(
623        io.grpc.stub.StreamObserver<Resp> responseObserver) {
624      switch (methodId) {
625        case METHODID_STREAMING_INPUT_CALL:
626          return (io.grpc.stub.StreamObserver<Req>) serviceImpl.streamingInputCall(
627              (io.grpc.stub.StreamObserver<io.grpc.testing.compiler.nano.Test.StreamingInputCallResponse>) responseObserver);
628        case METHODID_FULL_BIDI_CALL:
629          return (io.grpc.stub.StreamObserver<Req>) serviceImpl.fullBidiCall(
630              (io.grpc.stub.StreamObserver<io.grpc.testing.compiler.nano.Test.StreamingOutputCallResponse>) responseObserver);
631        case METHODID_HALF_BIDI_CALL:
632          return (io.grpc.stub.StreamObserver<Req>) serviceImpl.halfBidiCall(
633              (io.grpc.stub.StreamObserver<io.grpc.testing.compiler.nano.Test.StreamingOutputCallResponse>) responseObserver);
634        case METHODID_IMPORT:
635          return (io.grpc.stub.StreamObserver<Req>) serviceImpl.import_(
636              (io.grpc.stub.StreamObserver<io.grpc.testing.compiler.nano.Test.StreamingInputCallResponse>) responseObserver);
637        default:
638          throw new AssertionError();
639      }
640    }
641  }
642
643  private static volatile io.grpc.ServiceDescriptor serviceDescriptor;
644
645  public static io.grpc.ServiceDescriptor getServiceDescriptor() {
646    io.grpc.ServiceDescriptor result = serviceDescriptor;
647    if (result == null) {
648      synchronized (TestServiceGrpc.class) {
649        result = serviceDescriptor;
650        if (result == null) {
651          serviceDescriptor = result = io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME)
652              .addMethod(getUnaryCallMethod())
653              .addMethod(getStreamingOutputCallMethod())
654              .addMethod(getStreamingInputCallMethod())
655              .addMethod(getFullBidiCallMethod())
656              .addMethod(getHalfBidiCallMethod())
657              .addMethod(getImportMethod())
658              .build();
659        }
660      }
661    }
662    return result;
663  }
664}
665