protected void validateMessageType(Type expected) {
    if (expected != messageType) {
      throw new IllegalArgumentException("Message type is expected to be "
          + expected + " but got " + messageType);
    }
  }
@Test
  public void testValidateMessage() {
    RpcMessage msg = getRpcMessage(0, RpcMessage.Type.RPC_CALL);
    msg.validateMessageType(RpcMessage.Type.RPC_CALL);
  }