I am testing one project via protobuf protocol and using HTTP Request Sampler. The target appserver is also written on Java. There is a problem with errors in reponses:
"Could not read Protobuf message: Protocol message contained an invalid tag (zero).; nested exception is com.google.protobuf.InvalidProtocolBufferException: Protocol message contained an invalid tag (zero)"
The case is that it is happening not in 100% requests. When i used HttpClient4 it was about 30-40% of failed requests. After i changed it to HttpClient3.1 error rate decreased down to ~10% which is also not a good deal.
To send a protobuf message I am using variable ${data} in Bodydata tab of HttpSampler. And in BeanShell preProcessor i do the next:
(import and non-necessary stuff were ommited)
MapViewport mv = MapRequest.MapViewport.newBuilder().setMaxX(mc.getX()+15).setMaxY(mc.getY()+15).setMinX(mc.getX()-15).setMinY(mc.getY()-15).build();
byte[] data = mv.toByteArray();
vars.put("data", new String(data));
Also I tryed to to use different encoding like a new String(data,"UTF-8") anso on.
If to look on Request tab if View Result Tree I can say that all failed messages contain "?" symbol:
Seems like some weird symbols should not be sent, but ~10% of requests after saving a byte array to String contain them.


${data}, you're sending a string, which for some binary data is inserting?The first workaround that comes to mind is to write the binary stream to file and use the file path as variable in bodydata. But that would cause a lot of File I/O for high volume. Hmm.. this is a bit of a thinker. - RaGeHTTP Raw Requestfrom jmeter-plugins would be useful. - RaGe