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