1 // Copyright 2020 Google LLC 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 // 15 //////////////////////////////////////////////////////////////////////////////// 16 17 package com.google.crypto.tink.testing; 18 19 import com.google.crypto.tink.Version; 20 import com.google.crypto.tink.testing.proto.MetadataGrpc.MetadataImplBase; 21 import com.google.crypto.tink.testing.proto.ServerInfoRequest; 22 import com.google.crypto.tink.testing.proto.ServerInfoResponse; 23 import io.grpc.stub.StreamObserver; 24 import java.security.GeneralSecurityException; 25 26 /** Implement a gRPC service for the server's metadata. */ 27 public final class MetadataServiceImpl extends MetadataImplBase { 28 MetadataServiceImpl()29 public MetadataServiceImpl() throws GeneralSecurityException { 30 } 31 32 @Override getServerInfo( ServerInfoRequest request, StreamObserver<ServerInfoResponse> responseObserver)33 public void getServerInfo( 34 ServerInfoRequest request, StreamObserver<ServerInfoResponse> responseObserver) { 35 ServerInfoResponse response = 36 ServerInfoResponse.newBuilder() 37 .setLanguage("java") 38 .setTinkVersion(Version.TINK_VERSION) 39 .build(); 40 responseObserver.onNext(response); 41 responseObserver.onCompleted(); 42 } 43 } 44