@Override public TraversalResults traverse(ImgVertex startVertex) { TraversalResults results = null; Date startDate, endDate; // Socket to talk to server try { startDate = new Date(); Message message = prepareRequestMsg(startVertex); requester.send(Message.convertMessageToBytes(message), 0); byte[] reply = requester.recv(0); TraversalRepMsg traversalRepMsg = (TraversalRepMsg) Message.readFromBytes(reply); if (traversalRepMsg.isCompletedSuccesfully()) { results = readTraversalRepMsg(reply).getTraversalResults(); endDate = new Date(); results.setTime(endDate.getTime() - startDate.getTime()); } } catch (Exception x) { x.printStackTrace(); } return results; }
private TraversalRepMsg readTraversalRepMsg(byte[] msg) throws IOException, ClassNotFoundException { return (TraversalRepMsg) Message.readFromBytes(msg); }