public static MethodDescriptor<DynamicMessage, DynamicMessage> createJsonMarshallerMethodDescriptor(final String serviceName,
                                                                                                        final String methodName,
                                                                                                        final MethodDescriptor.MethodType methodType,
                                                                                                        final DynamicMessage request,
                                                                                                        final DynamicMessage response) {
        MethodDescriptor<DynamicMessage, DynamicMessage> methodDescriptor = METHOD_DESCRIPTOR_CACHE.get(serviceName + GrpcConstants.GRPC_JSON_SERVICE + methodName);
        if (methodDescriptor == null) {
            methodDescriptor = MethodDescriptor.<DynamicMessage, DynamicMessage>newBuilder()
                    .setType(getMethodType(methodType))
                    .setFullMethodName(MethodDescriptor.generateFullMethodName(serviceName + GrpcConstants.GRPC_JSON_SERVICE, methodName))
                    .setRequestMarshaller(new DynamicMessageMarshaller(request.getDescriptorForType()))
                    .setResponseMarshaller(new DynamicMessageMarshaller(response.getDescriptorForType()))
                    .build();
            METHOD_DESCRIPTOR_CACHE.put(serviceName + GrpcConstants.GRPC_JSON_SERVICE + methodName, methodDescriptor);

        }
        return methodDescriptor;
    }
@Test
    public void testCreateJsonMarshallerMethodDescriptor() {
        DynamicMessage jsonMessage = JsonMessage.buildJsonMessage();
        MethodDescriptor<DynamicMessage, DynamicMessage> echo = JsonMessage.createJsonMarshallerMethodDescriptor("echo.service",
                "echo",
                MethodDescriptor.MethodType.UNARY,
                jsonMessage,
                jsonMessage);

        assertEquals("echo.service" + GrpcConstants.GRPC_JSON_SERVICE + "/echo", echo.getFullMethodName());
        assertEquals(MethodDescriptor.MethodType.UNARY, echo.getType());
        assertFalse(echo.isIdempotent());
        assertFalse(echo.isSafe());
    }