@Override
        public void request(String rpcMethod, CompressionType compression, int uncompressedLength, byte[] compressedPayload,
                ResponseReceiver responseReceiver, double timeoutSeconds) {
            if (malfunctioning) {
                responseReceiver.receive(ResponseOrError.fromError("Malfunctioning"));
                return;
            }

            if(searchResult == null) {
                responseReceiver.receive(ResponseOrError.fromError("No result defined"));
                return;
            }
            var payload = ProtobufSerialization.serializeResult(searchResult);
            var compressionResult = compressor.compress(compression, payload);
            var response = new ProtobufResponse(compressionResult.type().getCode(), payload.length, compressionResult.data());
            responseReceiver.receive(ResponseOrError.fromResponse(response));
        }
Set to true to cause this to produce an error instead of a regular response
container-search/src/test/java/com/yahoo/search/dispatch/rpc/MockClient.java