JMeter’s TCP Sampler knows how to send ASCII text right out of the box.
But, what happens when we want to use one of the ASCII Control Characters (CC) that cannot be represented via the keyboard?
Say for example you want to send a ‘new line’ or ‘start of the header’
- Start of Header (SOH)
- Acknowledge (ACK)
(View full ASCII Characters table)
Define a JMeter variable called SOH in your jmx script with the value %01 (which stands for SOH ascii CC).
Add a Beanshell sampler/pre-process element (Before the TCP Sampler) and paste this code:
String result = URLDecoder.decode(vars.get("SOH"), "ASCII");
Your script should look like this:
Want to learn more? You'll want to view our on-demand recording, How to Create Advanced Load Testing Scenarios with JMeter