Package org.mockserver.grpc
Class GrpcHealthCheckHandler
java.lang.Object
org.mockserver.grpc.GrpcHealthCheckHandler
Handles grpc.health.v1.Health/Check requests without a proto descriptor.
Decodes the HealthCheckRequest manually (field 1 = service string),
looks up the ServingStatus from GrpcHealthRegistry, and encodes the
HealthCheckResponse manually (field 1 = status enum varint).
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondecodeServiceName(byte[] grpcFramedBody) Decodes a HealthCheckRequest from gRPC-framed bytes and returns the service name.byte[]encodeResponse(ServingStatus status) Encodes a HealthCheckResponse as gRPC-framed bytes.Returns the ServingStatus for the given service name from this handler's registry.booleanisHealthCheckRequest(String path) Returns true if the request path matches the health check path.
-
Field Details
-
HEALTH_CHECK_PATH
- See Also:
-
-
Constructor Details
-
GrpcHealthCheckHandler
-
-
Method Details
-
isHealthCheckRequest
Returns true if the request path matches the health check path. -
getStatus
Returns the ServingStatus for the given service name from this handler's registry. Delegates to the registry so tests using a non-singleton registry get correct results. -
decodeServiceName
Decodes a HealthCheckRequest from gRPC-framed bytes and returns the service name. Returns empty string if the body is null/empty or cannot be decoded. -
encodeResponse
Encodes a HealthCheckResponse as gRPC-framed bytes. HealthCheckResponse { ServingStatus status = 1; }
-