6

I am trying to use TCP Sampler for creating an automatic tests on top of IMAP4.
I am not using the Mail Reader Sampler because i need to allow injecting pure IMAP4 commands. My IMAP4 server (like any IMAP4 server) expect to receive any IMAP4 command end with CRLF (0D0A) so there fore i have ended my command in the Text to send area with a new line (Enter).

I sniffed the traffic and noticed that the JMeter added only LF (0A) after the command (without the Carriage return)

Is there something that i am missing here ?
How can i enforce JMeter TCP Sampler to add CRLF at the end of every TCP command ?

Aliaksandr Belik
  • 12,725
  • 6
  • 64
  • 90
user2650637
  • 119
  • 4

2 Answers2

2

Using XML-escaped solved the problem !!! http://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references

In the JMX file that is based on XML I appended the 0xD Character explicitly:

1 login 972557557566@is433.email.com a123456A
Aliaksandr Belik
  • 12,725
  • 6
  • 64
  • 90
user2650637
  • 119
  • 4
-1

While I could not get the EOL fix to work, nor the XML approach, I did find the following post which provides another solution: http://community.blazemeter.com/knowledgebase/articles/268778-how-to-send-control-characters-using-the-jmeter-tc. The general idea is to do the following:

  1. Create user defined variables called 'new_line' and 'carriage_return'.
  2. Set those user defined variables to %0A and %0D, respectively.
  3. Before your tcp sampler, create a BeanShell PreProcessor.
  4. In the BeanShell PreProcessor, overwrite the variable values like so:

    vars.put("new_line_char",URLDecoder.decode(vars.get("new_line_char"), "ASCII")); vars.put("carriage_return_char",URLDecoder.decode(vars.get("carriage_return_char"), "ASCII"));

  5. In your TCP Sampler, include your new variables at the end of your line

    some data to send to some place${carriage_return_char}${new_line_char}

jason.zissman
  • 2,750
  • 2
  • 19
  • 24