@Test
public void testWrongTcpEchoResponse (@Mocked final Socket socket) throws Exception {

    new Expectations() {{
        //return an outputstream we control
        socket.getOutputStream();
        result = testOutputStream;
        //return the sent message
        socket.getInputStream();
        result = new ByteArrayInputStream(WRONG_MESSAGE.getBytes());
    }};
    final EchoProtocolTcpTask task = new EchoProtocolTcpTask(qosTest, clientHolder.getTaskDescList().get(0), 0);
    final QoSTestResult res = task.call();
    // the server receives the message with a \n at the end, thus the comparison needs be made against a message w/appended \n
    assertEquals("Payload sent to server != " + CORRECT_MESSAGE, CORRECT_MESSAGE + "\n", testOutputStream.toString());
    assertEquals("Result did not return ERROR","ERROR", res.getResultMap().get(AbstractEchoProtocolTask.RESULT_STATUS));
    assertEquals("Wrong echo service host in result", ECHO_SERVICE_HOST, res.getResultMap().get("echo_protocol_objective_host"));
    assertEquals("Wrong protocol type in result", AbstractEchoProtocolTask.PROTOCOL_TCP, res.getResultMap().get(AbstractEchoProtocolTask.RESULT_PROTOCOL));
    assertEquals("Payload stored in result !=" + WRONG_MESSAGE, WRONG_MESSAGE, res.getResultMap().get(AbstractEchoProtocolTask.RESULT));
}