Skip to content
Permalink
Browse files
add stream sync test
  • Loading branch information
EarthChen committed Oct 9, 2021
1 parent d70e4ad commit 17d5d4ea21d98187d865e8ed887faed48fa8145d
Showing 1 changed file with 6 additions and 1 deletion.
@@ -135,10 +135,14 @@ public GreeterReply greetException(GreeterRequest request) {
@Override
public StreamObserver<GreeterRequest> greetStream(StreamObserver<GreeterReply> replyStream) {
return new StreamObserver<GreeterRequest>() {
int n = 0;

@Override
public void onNext(GreeterRequest data) {
n++;
System.out.println(data.getName() + " " + n);
replyStream.onNext(GreeterReply.newBuilder()
.setMessage(data.getName())
.setMessage(data.getName() + " " + n)
.build());
}

@@ -150,6 +154,7 @@ public void onError(Throwable throwable) {

@Override
public void onCompleted() {
System.out.println("[greetStream] onCompleted");
replyStream.onCompleted();
}
};

0 comments on commit 17d5d4e

Please sign in to comment.