Value[] args = new Value[] {
new Value(), new Value(),
};
args[0].setInt(0);
args[1].setInt(1);
new InvokeOnClientMessage(channel, methodName, thisRef, args).send();
MessageType type = channel.readMessageType();
assertEquals(MessageType.INVOKE, type);
InvokeOnClientMessage message = InvokeOnClientMessage.receive(channel);
assertEquals(methodName, message.getMethodName());
Value thisRefRecv = message.getThis();
assertEquals(ValueType.JAVA_OBJECT, thisRefRecv.getType());
assertEquals(42, thisRefRecv.getJavaObject().getRefid());
Value[] argsRecv = message.getArgs();
assertEquals(2, argsRecv.length);
for (int i = 0; i < 2; ++i) {
assertEquals(ValueType.INT, argsRecv[i].getType());
assertEquals(i, argsRecv[i].getInt());
}