### Question:
ChannelzService extends ChannelzGrpc.ChannelzImplBase { @Override public void getSocket( GetSocketRequest request, StreamObserver<GetSocketResponse> responseObserver) { InternalInstrumented<SocketStats> s = channelz.getSocket(request.getSocketId()); if (s == null) { responseObserver.onError( Status.NOT_FOUND.withDescription("Can't find socket " + request.getSocketId()) .asRuntimeException()); return; } GetSocketResponse resp; try { resp = GetSocketResponse.newBuilder().setSocket(ChannelzProtoUtil.toSocket(s)).build(); } catch (StatusRuntimeException e) { responseObserver.onError(e); return; } responseObserver.onNext(resp); responseObserver.onCompleted(); } @VisibleForTesting  ChannelzService(InternalChannelz channelz, int maxPageSize); static ChannelzService newInstance(int maxPageSize); @Override void getTopChannels(
      GetTopChannelsRequest request, StreamObserver<GetTopChannelsResponse> responseObserver); @Override void getChannel(
      GetChannelRequest request, StreamObserver<GetChannelResponse> responseObserver); @Override void getServers(
      GetServersRequest request, StreamObserver<GetServersResponse> responseObserver); @Override void getSubchannel(
      GetSubchannelRequest request, StreamObserver<GetSubchannelResponse> responseObserver); @Override void getSocket(
      GetSocketRequest request, StreamObserver<GetSocketResponse> responseObserver); @Override void getServerSockets(
      GetServerSocketsRequest request, StreamObserver<GetServerSocketsResponse> responseObserver);  }### Answer:
@Test public void getSocket() throws Exception { TestSocket socket = new TestSocket(); assertSocketNotFound(socket.getLogId().getId()); channelz.addClientSocket(socket); assertEquals( GetSocketResponse .newBuilder() .setSocket(ChannelzProtoUtil.toSocket(socket)) .build(), getSocketHelper(socket.getLogId().getId())); channelz.removeClientSocket(socket); assertSocketNotFound(socket.getLogId().getId()); }