- echoReply.setPayload(payload);
- echoReply.setLength( (short) (echoReply.getLength() + payload.length ));
+ if (payload != null && payload.length != 0 ) {
+ // the response must have the same payload as the request
+ echoReply.setPayload(payload);
+ echoReply.setLength( (short)(echoReply.getLength() + payload.length) );
+ }