class EchoProtocolUdpTask extends AbstractEchoProtocolTask {

	public QoSTestResult call() throws Exception {
		final QoSTestResult result = initQoSTestResult(QosMeasurementType.ECHO_PROTOCOL);
		try {
			onStart(result);

			if (testHost != null && testPort != null) {

				try (final DatagramSocket socket = new DatagramSocket()) {
					socket.connect(InetAddress.getByName(this.testHost), this.testPort);
					socket.setSoTimeout((int) (this.timeout / 1e6));

					final byte[] payloadBytes = payload.getBytes();

					final DatagramPacket sendPacket = new DatagramPacket(payloadBytes, payloadBytes.length, InetAddress.getByName(this.testHost), this.testPort);
					//increase the payload size to check for potentially added characters
					final DatagramPacket receivePacket = new DatagramPacket(new byte[payloadBytes.length + 1], payloadBytes.length + 1);

					final long startTime = System.nanoTime();
					socket.send(sendPacket);
					socket.receive(receivePacket);
					final long duration = System.nanoTime() - startTime;

					final String testResponse = new String(receivePacket.getData(), 0, receivePacket.getLength());
					if (sendPacket.getLength() == receivePacket.getLength() && payload.equals(testResponse)) {
                        result.getResultMap().put(RESULT_STATUS, "OK");
                    } else {
                        result.getResultMap().put(RESULT_STATUS, "ERROR");
                    }

					result.getResultMap().put(RESULT_RTT_NS, Long.toString(duration));

					result.getResultMap().put(RESULT, testResponse);

				} catch (SocketTimeoutException ex) {
					result.getResultMap().put(RESULT_STATUS, "TIMEOUT");
				} catch (Exception ex) {
				    ex.printStackTrace();
					result.getResultMap().put(RESULT_STATUS, "ERROR");
				}

			} else {
				result.getResultMap().put(RESULT_STATUS, "ERROR");
			}

		} catch (final Exception ex) {
			ex.printStackTrace();
			result.getResultMap().put(RESULT_STATUS, "ERROR");
		} finally {
			if (this.testPort != null) {
				result.getResultMap().put(RESULT_PORT, testPort);
			}

			if (this.testHost != null) {
				result.getResultMap().put("echo_protocol_objective_host", this.testHost);
			}

			result.getResultMap().put(RESULT_TIMEOUT, timeout);

			result.getResultMap().put(AbstractEchoProtocolTask.PARAM_PAYLOAD, this.payload);

			result.getResultMap().put(AbstractEchoProtocolTask.RESULT_PROTOCOL, AbstractEchoProtocolTask.PROTOCOL_UDP);

			onEnd(result);
		}

		return result;
		    
	}

	public  EchoProtocolUdpTask(QualityOfServiceTest nnTest, TaskDesc taskDesc, int threadId);

}