/**
   * Checks if the given class is registered with the RPC service.
   *
   * @param throwableType the class to check
   * @return <code>true</code> if the given class is registered with the RPC service, <code>false
   *     </code> otherwise
   */
  private boolean isThrowableRegistered(final Class<? extends Throwable> throwableType) {

    final Kryo kryo = KryoUtil.getKryo();
    try {
      kryo.getRegistration(throwableType);
    } catch (final IllegalArgumentException e) {
      return false;
    }

    return true;
  }
  private DatagramPacket[] messageToPackets(
      final InetSocketAddress remoteSocketAddress, final RPCMessage rpcMessage) {

    final MultiPacketOutputStream mpos =
        new MultiPacketOutputStream(RPCMessage.MAXIMUM_MSG_SIZE + RPCMessage.METADATA_SIZE);
    final Kryo kryo = KryoUtil.getKryo();
    kryo.reset();

    final Output output = new Output(mpos);

    kryo.writeObject(output, new RPCEnvelope(rpcMessage));
    output.close();
    mpos.close();

    return mpos.createPackets(remoteSocketAddress);
  }