if (!(message.elementAt(1) instanceof OtpErlangAtom))
System.out.println("invalid request received by worker, expected an atom, got "+message.elementAt(1));
OtpErlangAtom command = (OtpErlangAtom) message.elementAt(1);
if (!(message.elementAt(0) instanceof OtpErlangRef))
System.out.println("invalid request received by worker, expected a ref, got "+message.elementAt(0));
final OtpErlangRef ref = (OtpErlangRef) message.elementAt(0);
if (command.equals(msgEcho))
mbox.send(erlangPartner,new OtpErlangTuple(new OtpErlangObject[]{ref,msgWorkerOk}));
if (command.equals(msgStop))
mbox.send(erlangPartner,new OtpErlangTuple(new OtpErlangObject[]{ref,msgWorkerOk}));