<?xml version="1.0" encoding="UTF-8"?>
<jmeterTestPlan version="1.2" properties="3.4" jmeter="3.4-SNAPSHOT.20171027">
  <hashTree>
    <TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="Test Plan" enabled="true">
      <stringProp name="TestPlan.comments">https://stackoverflow.com/questions/8403462/jmeter-execute-command-over-telnet-using-beanshell
https://stackoverflow.com/questions/37702682/jmeter-tcp-sampler-doesnt-close-the-socket-after-data-is-sent/37718290#37718290</stringProp>
      <boolProp name="TestPlan.functional_mode">false</boolProp>
      <boolProp name="TestPlan.serialize_threadgroups">true</boolProp>
      <elementProp name="TestPlan.user_defined_variables" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
        <collectionProp name="Arguments.arguments"/>
      </elementProp>
      <stringProp name="TestPlan.user_define_classpath"></stringProp>
      <boolProp name="TestPlan.tearDown_on_shutdown">true</boolProp>
    </TestPlan>
    <hashTree>
      <Arguments guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
        <collectionProp name="Arguments.arguments">
          <elementProp name="port" elementType="Argument">
            <stringProp name="Argument.name">port</stringProp>
            <stringProp name="Argument.value">2222</stringProp>
            <stringProp name="Argument.metadata">=</stringProp>
          </elementProp>
        </collectionProp>
      </Arguments>
      <hashTree/>
      <ConfigTestElement guiclass="TCPConfigGui" testclass="ConfigTestElement" testname="TCP Sampler Config" enabled="true">
        <stringProp name="TCPSampler.server">localhost</stringProp>
        <boolProp name="TCPSampler.reUseConnection">true</boolProp>
        <stringProp name="TCPSampler.port">${port}</stringProp>
        <boolProp name="TCPSampler.nodelay">false</boolProp>
        <stringProp name="TCPSampler.timeout">5000</stringProp>
        <stringProp name="TCPSampler.request"></stringProp>
        <boolProp name="TCPSampler.closeConnection">true</boolProp>
        <stringProp name="TCPSampler.ctimeout">3000</stringProp>
        <stringProp name="TCPSampler.EolByte">10</stringProp>
      </ConfigTestElement>
      <hashTree/>
      <SetupThreadGroup guiclass="SetupThreadGroupGui" testclass="SetupThreadGroup" testname="setUp Thread Group" enabled="true">
        <stringProp name="ThreadGroup.on_sample_error">stoptest</stringProp>
        <elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller" enabled="true">
          <boolProp name="LoopController.continue_forever">false</boolProp>
          <stringProp name="LoopController.loops">1</stringProp>
        </elementProp>
        <stringProp name="ThreadGroup.num_threads">1</stringProp>
        <stringProp name="ThreadGroup.ramp_time">1</stringProp>
        <boolProp name="ThreadGroup.scheduler">false</boolProp>
        <stringProp name="ThreadGroup.duration"></stringProp>
        <stringProp name="ThreadGroup.delay"></stringProp>
      </SetupThreadGroup>
      <hashTree>
        <JSR223Sampler guiclass="TestBeanGUI" testclass="JSR223Sampler" testname="MinaTcpServerInitializer" enabled="true">
          <stringProp name="scriptLanguage">groovy</stringProp>
          <stringProp name="parameters"></stringProp>
          <stringProp name="filename"></stringProp>
          <stringProp name="cacheKey">46e3b654-c6ad-4aa5-8188-e7e368c5ac81</stringProp>
          <stringProp name="script">import java.util.Date;
import java.io.IOException;
import java.net.InetSocketAddress;
import java.nio.charset.Charset;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import org.apache.mina.core.session.IdleStatus;
import org.apache.mina.core.service.IoHandlerAdapter;
import org.apache.mina.core.session.IoSession;
import org.apache.mina.core.service.IoAcceptor;
import org.apache.mina.core.session.IdleStatus;
import org.apache.mina.filter.codec.ProtocolCodecFilter;
import org.apache.mina.filter.codec.textline.TextLineCodecFactory;
import org.apache.mina.filter.logging.LoggingFilter;
import org.apache.mina.transport.socket.nio.NioSocketAcceptor;

class TimeServerHandler extends IoHandlerAdapter
{
	private static final String EOL = &quot;\n&quot;;
    Logger log = LoggerFactory.getLogger(TimeServerHandler.class);	
    public void exceptionCaught( IoSession session, Throwable cause ) throws Exception
    {
    	   log.error(&quot;Exception occured&quot;, cause);
    	   session.closeNow();
    }

    public void messageReceived( IoSession session, Object message ) throws Exception
    {
        String str = message.trim().toString();
        log.info(&quot;Received {}&quot;, str);
        
        String[] words = str.split(&quot; &quot;);
        if(words[0].equalsIgnoreCase(&quot;quit&quot;) ) {
            session.close();
        }
	   else if(words[0].equalsIgnoreCase(&quot;sleep&quot;)) {
	   	log.info(&quot;Sleeping for {}ms&quot;, words[1].toLong());
        	Thread.sleep(words[1].toLong());
	     Date date = new Date();
        	session.write( date.format(&quot;dd/MM/yyyy HH:mm:ss&quot;)+EOL );
        }
        else {
	        Date date = new Date();
     	   session.write( date.format(&quot;dd/MM/yyyy HH:mm:ss&quot;)+EOL );
        }
	   log.info(&quot;Message written...&quot;);
    }

    public void sessionIdle( IoSession session, IdleStatus status ) throws Exception
    {
        log.info(&quot;IDLE {}&quot;, session.getIdleCount(status));
    }
}

IoAcceptor acceptor = new NioSocketAcceptor();
acceptor.getFilterChain().addLast( &quot;logger&quot;, new LoggingFilter() );
acceptor.getFilterChain().addLast( &quot;codec&quot;, new ProtocolCodecFilter( new TextLineCodecFactory( Charset.forName( &quot;UTF-8&quot; ))));
acceptor.setHandler( new TimeServerHandler() );
acceptor.setReuseAddress(true);
acceptor.getSessionConfig().setReadBufferSize( 2048 );
acceptor.getSessionConfig().setIdleTime( IdleStatus.BOTH_IDLE, 10 );
props.put(&quot;TCP_SERVER&quot;, acceptor);
def thread = Thread.start {
	acceptor.bind( new InetSocketAddress(Integer.parseInt(vars.get(&quot;port&quot;))));
};

SampleResult.setResponseMessageOK();
SampleResult.setResponseData(&quot;Starting TCP Server&quot;, &quot;UTF-8&quot;);</stringProp>
        </JSR223Sampler>
        <hashTree/>
        <TestAction guiclass="TestActionGui" testclass="TestAction" testname="Think Time" enabled="true">
          <intProp name="ActionProcessor.action">1</intProp>
          <intProp name="ActionProcessor.target">0</intProp>
          <stringProp name="ActionProcessor.duration">0</stringProp>
        </TestAction>
        <hashTree>
          <UniformRandomTimer guiclass="UniformRandomTimerGui" testclass="UniformRandomTimer" testname="Pause" enabled="true">
            <stringProp name="ConstantTimer.delay">1000</stringProp>
            <stringProp name="RandomTimer.range">100</stringProp>
          </UniformRandomTimer>
          <hashTree/>
        </hashTree>
      </hashTree>
      <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="TG-TCPClientImpl" enabled="true">
        <stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
        <elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller" enabled="true">
          <boolProp name="LoopController.continue_forever">false</boolProp>
          <stringProp name="LoopController.loops">1</stringProp>
        </elementProp>
        <stringProp name="ThreadGroup.num_threads">1</stringProp>
        <stringProp name="ThreadGroup.ramp_time">1</stringProp>
        <boolProp name="ThreadGroup.scheduler">false</boolProp>
        <stringProp name="ThreadGroup.duration"></stringProp>
        <stringProp name="ThreadGroup.delay"></stringProp>
      </ThreadGroup>
      <hashTree>
        <TestAction guiclass="TestActionGui" testclass="TestAction" testname="TA_CARIAGE_RETURN_SETTER" enabled="true">
          <intProp name="ActionProcessor.action">1</intProp>
          <intProp name="ActionProcessor.target">0</intProp>
          <stringProp name="ActionProcessor.duration">0</stringProp>
        </TestAction>
        <hashTree>
          <JSR223PreProcessor guiclass="TestBeanGUI" testclass="JSR223PreProcessor" testname="JSR223 PreProcessor" enabled="true">
            <stringProp name="scriptLanguage">groovy</stringProp>
            <stringProp name="parameters"></stringProp>
            <stringProp name="filename"></stringProp>
            <stringProp name="cacheKey">699ef483-ad6f-4eac-a6f7-0371cbc65e63</stringProp>
            <stringProp name="script">vars.put(&quot;LF&quot;,URLDecoder.decode(&quot;%0D&quot;, &quot;ASCII&quot;));
vars.put(&quot;CR&quot;,URLDecoder.decode(&quot;%0A&quot;, &quot;ASCII&quot;)); </stringProp>
            <stringProp name="TestPlan.comments">Set Cariage return and Line feed as variables</stringProp>
          </JSR223PreProcessor>
          <hashTree/>
        </hashTree>
        <TCPSampler guiclass="TCPSamplerGui" testclass="TCPSampler" testname="TCP Sampler-Hello" enabled="true">
          <stringProp name="TCPSampler.classname">org.apache.jmeter.protocol.tcp.sampler.TCPClientImpl</stringProp>
          <stringProp name="TCPSampler.server"></stringProp>
          <boolProp name="TCPSampler.reUseConnection">true</boolProp>
          <stringProp name="TCPSampler.port"></stringProp>
          <boolProp name="TCPSampler.nodelay">false</boolProp>
          <stringProp name="TCPSampler.timeout"></stringProp>
          <stringProp name="TCPSampler.request">hello${CR}${LF}</stringProp>
          <boolProp name="TCPSampler.closeConnection">false</boolProp>
          <stringProp name="ConfigTestElement.username"></stringProp>
          <stringProp name="ConfigTestElement.password"></stringProp>
        </TCPSampler>
        <hashTree>
          <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="RA_time" enabled="true">
            <collectionProp name="Asserion.test_strings">
              <stringProp name="-1168273790">${__time(dd/MM/yyyy HH:mm,)}</stringProp>
            </collectionProp>
            <stringProp name="Assertion.test_field">Assertion.response_data</stringProp>
            <boolProp name="Assertion.assume_success">false</boolProp>
            <intProp name="Assertion.test_type">16</intProp>
          </ResponseAssertion>
          <hashTree/>
        </hashTree>
        <TCPSampler guiclass="TCPSamplerGui" testclass="TCPSampler" testname="TCP Sampler-Timeout" enabled="true">
          <stringProp name="TestPlan.comments">Test timeout</stringProp>
          <stringProp name="TCPSampler.classname">org.apache.jmeter.protocol.tcp.sampler.TCPClientImpl</stringProp>
          <stringProp name="TCPSampler.server"></stringProp>
          <boolProp name="TCPSampler.reUseConnection">true</boolProp>
          <stringProp name="TCPSampler.port"></stringProp>
          <boolProp name="TCPSampler.nodelay">false</boolProp>
          <stringProp name="TCPSampler.timeout">1000</stringProp>
          <stringProp name="TCPSampler.ctimeout">1000</stringProp>
          <stringProp name="TCPSampler.request">sleep 2000${CR}${LF}</stringProp>
          <boolProp name="TCPSampler.closeConnection">false</boolProp>
          <stringProp name="ConfigTestElement.username"></stringProp>
          <stringProp name="ConfigTestElement.password"></stringProp>
        </TCPSampler>
        <hashTree>
          <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="RC_500" enabled="true">
            <collectionProp name="Asserion.test_strings">
              <stringProp name="52469">500</stringProp>
            </collectionProp>
            <stringProp name="Assertion.test_field">Assertion.response_code</stringProp>
            <boolProp name="Assertion.assume_success">true</boolProp>
            <intProp name="Assertion.test_type">8</intProp>
          </ResponseAssertion>
          <hashTree/>
          <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="RA_ReadException" enabled="true">
            <collectionProp name="Asserion.test_strings">
              <stringProp name="1515665865">org.apache.jmeter.protocol.tcp.sampler.ReadException</stringProp>
            </collectionProp>
            <stringProp name="Assertion.test_field">Assertion.response_message</stringProp>
            <boolProp name="Assertion.assume_success">true</boolProp>
            <intProp name="Assertion.test_type">16</intProp>
          </ResponseAssertion>
          <hashTree/>
        </hashTree>
        <TCPSampler guiclass="TCPSamplerGui" testclass="TCPSampler" testname="TCP Sampler-Quit" enabled="true">
          <stringProp name="TCPSampler.classname">org.apache.jmeter.protocol.tcp.sampler.TCPClientImpl</stringProp>
          <stringProp name="TCPSampler.server"></stringProp>
          <boolProp name="TCPSampler.reUseConnection">true</boolProp>
          <stringProp name="TCPSampler.port"></stringProp>
          <boolProp name="TCPSampler.nodelay">false</boolProp>
          <stringProp name="TCPSampler.timeout"></stringProp>
          <stringProp name="TCPSampler.request">quit${CR}${LF}</stringProp>
          <boolProp name="TCPSampler.closeConnection">false</boolProp>
          <stringProp name="ConfigTestElement.username"></stringProp>
          <stringProp name="ConfigTestElement.password"></stringProp>
        </TCPSampler>
        <hashTree/>
      </hashTree>
      <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="TG-BinaryTCPClientImpl" enabled="true">
        <stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
        <elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller" enabled="true">
          <boolProp name="LoopController.continue_forever">false</boolProp>
          <stringProp name="LoopController.loops">1</stringProp>
        </elementProp>
        <stringProp name="ThreadGroup.num_threads">1</stringProp>
        <stringProp name="ThreadGroup.ramp_time">1</stringProp>
        <boolProp name="ThreadGroup.scheduler">false</boolProp>
        <stringProp name="ThreadGroup.duration"></stringProp>
        <stringProp name="ThreadGroup.delay"></stringProp>
      </ThreadGroup>
      <hashTree>
        <TCPSampler guiclass="TCPSamplerGui" testclass="TCPSampler" testname="TCP Sampler-Binary-Hello" enabled="true">
          <stringProp name="TCPSampler.classname">org.apache.jmeter.protocol.tcp.sampler.BinaryTCPClientImpl</stringProp>
          <stringProp name="TCPSampler.server"></stringProp>
          <boolProp name="TCPSampler.reUseConnection">false</boolProp>
          <stringProp name="TCPSampler.port"></stringProp>
          <boolProp name="TCPSampler.nodelay">false</boolProp>
          <stringProp name="TCPSampler.timeout"></stringProp>
          <stringProp name="TCPSampler.request">68656C6C6F0A0D</stringProp>
          <boolProp name="TCPSampler.closeConnection">false</boolProp>
          <stringProp name="ConfigTestElement.username"></stringProp>
          <stringProp name="ConfigTestElement.password"></stringProp>
        </TCPSampler>
        <hashTree>
          <JSR223PostProcessor guiclass="TestBeanGUI" testclass="JSR223PostProcessor" testname="JSPP-decode" enabled="true">
            <stringProp name="cacheKey">e7ac0019-16aa-40b4-b30f-e254c0a75f27</stringProp>
            <stringProp name="filename"></stringProp>
            <stringProp name="parameters"></stringProp>
            <stringProp name="script">import org.apache.commons.codec.binary.Hex;
Hex hex = new Hex();
OUT.println(new String(hex.decode(prev.getResponseData())));
vars.put(&quot;result_decoded&quot;, new String(hex.decode(prev.getResponseData())));</stringProp>
            <stringProp name="scriptLanguage">groovy</stringProp>
          </JSR223PostProcessor>
          <hashTree/>
          <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="RA_time" enabled="true">
            <collectionProp name="Asserion.test_strings">
              <stringProp name="-1168273790">${__time(dd/MM/yyyy HH:mm,)}</stringProp>
            </collectionProp>
            <stringProp name="Assertion.test_field">Assertion.response_data</stringProp>
            <boolProp name="Assertion.assume_success">false</boolProp>
            <intProp name="Assertion.test_type">16</intProp>
            <stringProp name="Assertion.scope">variable</stringProp>
            <stringProp name="Scope.variable">result_decoded</stringProp>
          </ResponseAssertion>
          <hashTree/>
        </hashTree>
        <TCPSampler guiclass="TCPSamplerGui" testclass="TCPSampler" testname="TCP Sampler-Binary-Timeout" enabled="true">
          <stringProp name="TCPSampler.classname">org.apache.jmeter.protocol.tcp.sampler.BinaryTCPClientImpl</stringProp>
          <stringProp name="TCPSampler.server"></stringProp>
          <boolProp name="TCPSampler.reUseConnection">false</boolProp>
          <stringProp name="TCPSampler.port"></stringProp>
          <boolProp name="TCPSampler.nodelay">false</boolProp>
          <stringProp name="TCPSampler.timeout">1000</stringProp>
          <stringProp name="TCPSampler.ctimeout">1000</stringProp>
          <stringProp name="TCPSampler.request">736C65657020323030300A0D</stringProp>
          <boolProp name="TCPSampler.closeConnection">false</boolProp>
          <stringProp name="ConfigTestElement.username"></stringProp>
          <stringProp name="ConfigTestElement.password"></stringProp>
        </TCPSampler>
        <hashTree>
          <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="RC_500" enabled="true">
            <collectionProp name="Asserion.test_strings">
              <stringProp name="52469">500</stringProp>
            </collectionProp>
            <stringProp name="Assertion.test_field">Assertion.response_code</stringProp>
            <boolProp name="Assertion.assume_success">true</boolProp>
            <intProp name="Assertion.test_type">8</intProp>
          </ResponseAssertion>
          <hashTree/>
          <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="RA_ReadException" enabled="true">
            <collectionProp name="Asserion.test_strings">
              <stringProp name="1515665865">org.apache.jmeter.protocol.tcp.sampler.ReadException</stringProp>
            </collectionProp>
            <stringProp name="Assertion.test_field">Assertion.response_message</stringProp>
            <boolProp name="Assertion.assume_success">true</boolProp>
            <intProp name="Assertion.test_type">16</intProp>
          </ResponseAssertion>
          <hashTree/>
        </hashTree>
        <TCPSampler guiclass="TCPSamplerGui" testclass="TCPSampler" testname="TCP Sampler-Binary-Quit" enabled="true">
          <stringProp name="TCPSampler.classname">org.apache.jmeter.protocol.tcp.sampler.BinaryTCPClientImpl</stringProp>
          <stringProp name="TCPSampler.server"></stringProp>
          <boolProp name="TCPSampler.reUseConnection">false</boolProp>
          <stringProp name="TCPSampler.port"></stringProp>
          <boolProp name="TCPSampler.nodelay">false</boolProp>
          <stringProp name="TCPSampler.timeout"></stringProp>
          <stringProp name="TCPSampler.request">717569740A0D</stringProp>
          <boolProp name="TCPSampler.closeConnection">false</boolProp>
          <stringProp name="ConfigTestElement.username"></stringProp>
          <stringProp name="ConfigTestElement.password"></stringProp>
        </TCPSampler>
        <hashTree/>
      </hashTree>
      <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="TG-TCPClientImpl-Errors" enabled="true">
        <stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
        <elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller" enabled="true">
          <boolProp name="LoopController.continue_forever">false</boolProp>
          <stringProp name="LoopController.loops">1</stringProp>
        </elementProp>
        <stringProp name="ThreadGroup.num_threads">1</stringProp>
        <stringProp name="ThreadGroup.ramp_time">1</stringProp>
        <boolProp name="ThreadGroup.scheduler">false</boolProp>
        <stringProp name="ThreadGroup.duration"></stringProp>
        <stringProp name="ThreadGroup.delay"></stringProp>
      </ThreadGroup>
      <hashTree>
        <TCPSampler guiclass="TCPSamplerGui" testclass="TCPSampler" testname="TCP Sampler-ConnectError" enabled="true">
          <stringProp name="TCPSampler.classname">org.apache.jmeter.protocol.tcp.sampler.BinaryTCPClientImpl</stringProp>
          <stringProp name="TCPSampler.server">localhost</stringProp>
          <boolProp name="TCPSampler.reUseConnection">true</boolProp>
          <stringProp name="TCPSampler.port">2223</stringProp>
          <boolProp name="TCPSampler.nodelay">false</boolProp>
          <stringProp name="TCPSampler.timeout"></stringProp>
          <stringProp name="TCPSampler.request">68656C6C6F0A0D</stringProp>
          <boolProp name="TCPSampler.closeConnection">true</boolProp>
          <stringProp name="ConfigTestElement.username"></stringProp>
          <stringProp name="ConfigTestElement.password"></stringProp>
        </TCPSampler>
        <hashTree>
          <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="RC_500" enabled="true">
            <collectionProp name="Asserion.test_strings">
              <stringProp name="52469">500</stringProp>
            </collectionProp>
            <stringProp name="Assertion.test_field">Assertion.response_code</stringProp>
            <boolProp name="Assertion.assume_success">true</boolProp>
            <intProp name="Assertion.test_type">16</intProp>
            <stringProp name="Scope.variable">result_decoded</stringProp>
          </ResponseAssertion>
          <hashTree/>
          <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="RA_ConnectException" enabled="true">
            <collectionProp name="Asserion.test_strings">
              <stringProp name="2118305654">java.net.ConnectException: Connection refused</stringProp>
            </collectionProp>
            <stringProp name="Assertion.test_field">Assertion.response_message</stringProp>
            <boolProp name="Assertion.assume_success">true</boolProp>
            <intProp name="Assertion.test_type">16</intProp>
            <stringProp name="Scope.variable">result_decoded</stringProp>
          </ResponseAssertion>
          <hashTree/>
          <JSR223PostProcessor guiclass="TestBeanGUI" testclass="JSR223PostProcessor" testname="JSR223PP_NormalizeResponseMessage" enabled="true">
            <stringProp name="TestPlan.comments">We strip part of Response Message after &apos;(&apos; as it&apos;s different between JVMs and breaks results comparison</stringProp>
            <stringProp name="scriptLanguage">groovy</stringProp>
            <stringProp name="parameters"></stringProp>
            <stringProp name="filename"></stringProp>
            <stringProp name="cacheKey">d65ff29e-5d0c-47df-b464-e7a84fa88e66</stringProp>
            <stringProp name="script">String oldResponseMessage = prev.getResponseMessage();
// In practice the exception might have lot of flavours:
//  &quot;java.net.ConnectException: Connection refused&quot;
//  &quot;java.net.ConnectException: Connection refused (Connection refused)&quot;
//  &quot;java.net.ConnectException: Connection refused: refused&quot;
// So we normalize it

if (oldResponseMessage != null &amp;&amp; oldResponseMessage.contains(&quot;java.net.ConnectException: Connection refused&quot;)) {
    prev.setResponseMessage(&quot;java.net.ConnectException: Connection refused&quot;);
}
</stringProp>
          </JSR223PostProcessor>
          <hashTree/>
        </hashTree>
        <TCPSampler guiclass="TCPSamplerGui" testclass="TCPSampler" testname="TCP Sampler-HostUnknown" enabled="true">
          <stringProp name="TCPSampler.classname">org.apache.jmeter.protocol.tcp.sampler.BinaryTCPClientImpl</stringProp>
          <stringProp name="TCPSampler.server">localhostXXXX</stringProp>
          <boolProp name="TCPSampler.reUseConnection">true</boolProp>
          <stringProp name="TCPSampler.port">2223</stringProp>
          <boolProp name="TCPSampler.nodelay">false</boolProp>
          <stringProp name="TCPSampler.timeout"></stringProp>
          <stringProp name="TCPSampler.request">68656C6C6F0A0D</stringProp>
          <boolProp name="TCPSampler.closeConnection">false</boolProp>
          <stringProp name="ConfigTestElement.username"></stringProp>
          <stringProp name="ConfigTestElement.password"></stringProp>
        </TCPSampler>
        <hashTree>
          <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="RC_500" enabled="true">
            <collectionProp name="Asserion.test_strings">
              <stringProp name="52469">500</stringProp>
            </collectionProp>
            <stringProp name="Assertion.test_field">Assertion.response_code</stringProp>
            <boolProp name="Assertion.assume_success">true</boolProp>
            <intProp name="Assertion.test_type">16</intProp>
            <stringProp name="Scope.variable">result_decoded</stringProp>
          </ResponseAssertion>
          <hashTree/>
          <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="RA_UnknownHostException" enabled="true">
            <collectionProp name="Asserion.test_strings">
              <stringProp name="1613728243">java.net.UnknownHostException: localhostXXXX</stringProp>
            </collectionProp>
            <stringProp name="Assertion.test_field">Assertion.response_message</stringProp>
            <boolProp name="Assertion.assume_success">true</boolProp>
            <intProp name="Assertion.test_type">16</intProp>
            <stringProp name="Scope.variable">result_decoded</stringProp>
          </ResponseAssertion>
          <hashTree/>
        </hashTree>
        <TCPSampler guiclass="TCPSamplerGui" testclass="TCPSampler" testname="TCP Sampler-ClassNotFoundException" enabled="true">
          <stringProp name="TCPSampler.classname">org.foo.xxx</stringProp>
          <stringProp name="TCPSampler.server">localhost</stringProp>
          <boolProp name="TCPSampler.reUseConnection">true</boolProp>
          <stringProp name="TCPSampler.port">2222</stringProp>
          <boolProp name="TCPSampler.nodelay">false</boolProp>
          <stringProp name="TCPSampler.timeout"></stringProp>
          <stringProp name="TCPSampler.request">68656C6C6F0A0D</stringProp>
          <boolProp name="TCPSampler.closeConnection">false</boolProp>
          <stringProp name="ConfigTestElement.username"></stringProp>
          <stringProp name="ConfigTestElement.password"></stringProp>
        </TCPSampler>
        <hashTree>
          <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="RC_500" enabled="true">
            <collectionProp name="Asserion.test_strings">
              <stringProp name="52469">500</stringProp>
            </collectionProp>
            <stringProp name="Assertion.test_field">Assertion.response_code</stringProp>
            <boolProp name="Assertion.assume_success">true</boolProp>
            <intProp name="Assertion.test_type">16</intProp>
            <stringProp name="Scope.variable">result_decoded</stringProp>
          </ResponseAssertion>
          <hashTree/>
          <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="RA_no_protocol_handler" enabled="true">
            <collectionProp name="Asserion.test_strings">
              <stringProp name="-715322569">Protocol handler not found</stringProp>
            </collectionProp>
            <stringProp name="Assertion.test_field">Assertion.response_message</stringProp>
            <boolProp name="Assertion.assume_success">true</boolProp>
            <intProp name="Assertion.test_type">16</intProp>
            <stringProp name="Scope.variable">result_decoded</stringProp>
          </ResponseAssertion>
          <hashTree/>
        </hashTree>
      </hashTree>
      <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="TG-TCPClientImpl" enabled="false">
        <stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
        <elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller" enabled="true">
          <boolProp name="LoopController.continue_forever">false</boolProp>
          <stringProp name="LoopController.loops">1</stringProp>
        </elementProp>
        <stringProp name="ThreadGroup.num_threads">1</stringProp>
        <stringProp name="ThreadGroup.ramp_time">1</stringProp>
        <boolProp name="ThreadGroup.scheduler">false</boolProp>
        <stringProp name="ThreadGroup.duration"></stringProp>
        <stringProp name="ThreadGroup.delay"></stringProp>
      </ThreadGroup>
      <hashTree>
        <TCPSampler guiclass="TCPSamplerGui" testclass="TCPSampler" testname="TCP Sampler-Hello" enabled="true">
          <stringProp name="TCPSampler.classname">org.apache.jmeter.protocol.tcp.sampler.LengthPrefixedBinaryTCPClientImpl</stringProp>
          <stringProp name="TCPSampler.server"></stringProp>
          <boolProp name="TCPSampler.reUseConnection">true</boolProp>
          <stringProp name="TCPSampler.port"></stringProp>
          <boolProp name="TCPSampler.nodelay">false</boolProp>
          <stringProp name="TCPSampler.timeout"></stringProp>
          <stringProp name="TCPSampler.request">68656C6C6F0A0D</stringProp>
          <boolProp name="TCPSampler.closeConnection">true</boolProp>
          <stringProp name="ConfigTestElement.username"></stringProp>
          <stringProp name="ConfigTestElement.password"></stringProp>
        </TCPSampler>
        <hashTree>
          <JSR223PostProcessor guiclass="TestBeanGUI" testclass="JSR223PostProcessor" testname="JSPP-decode" enabled="true">
            <stringProp name="cacheKey">e7ac0019-16aa-40b4-b30f-e254c0a75f27</stringProp>
            <stringProp name="filename"></stringProp>
            <stringProp name="parameters"></stringProp>
            <stringProp name="script">import org.apache.commons.codec.binary.Hex;
Hex hex = new Hex();
OUT.println(new String(hex.decode(prev.getResponseData())));
vars.put(&quot;result_decoded&quot;, new String(hex.decode(prev.getResponseData())));</stringProp>
            <stringProp name="scriptLanguage">groovy</stringProp>
          </JSR223PostProcessor>
          <hashTree/>
          <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true">
            <collectionProp name="Asserion.test_strings">
              <stringProp name="-1168273790">${__time(dd/MM/yyyy HH:mm,)}</stringProp>
            </collectionProp>
            <stringProp name="Assertion.test_field">Assertion.response_data</stringProp>
            <boolProp name="Assertion.assume_success">false</boolProp>
            <intProp name="Assertion.test_type">16</intProp>
            <stringProp name="Assertion.scope">variable</stringProp>
            <stringProp name="Scope.variable">result_decoded</stringProp>
          </ResponseAssertion>
          <hashTree/>
        </hashTree>
        <TCPSampler guiclass="TCPSamplerGui" testclass="TCPSampler" testname="TCP Sampler-Quit" enabled="true">
          <stringProp name="TCPSampler.classname">org.apache.jmeter.protocol.tcp.sampler.LengthPrefixedBinaryTCPClientImpl</stringProp>
          <stringProp name="TCPSampler.server"></stringProp>
          <boolProp name="TCPSampler.reUseConnection">true</boolProp>
          <stringProp name="TCPSampler.port"></stringProp>
          <boolProp name="TCPSampler.nodelay">false</boolProp>
          <stringProp name="TCPSampler.timeout"></stringProp>
          <stringProp name="TCPSampler.request">717569740A0D</stringProp>
          <boolProp name="TCPSampler.closeConnection">true</boolProp>
          <stringProp name="ConfigTestElement.username"></stringProp>
          <stringProp name="ConfigTestElement.password"></stringProp>
        </TCPSampler>
        <hashTree/>
      </hashTree>
      <PostThreadGroup guiclass="PostThreadGroupGui" testclass="PostThreadGroup" testname="tearDown Thread Group" enabled="true">
        <stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
        <elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller" enabled="true">
          <boolProp name="LoopController.continue_forever">false</boolProp>
          <stringProp name="LoopController.loops">1</stringProp>
        </elementProp>
        <stringProp name="ThreadGroup.num_threads">1</stringProp>
        <stringProp name="ThreadGroup.ramp_time">1</stringProp>
        <boolProp name="ThreadGroup.scheduler">false</boolProp>
        <stringProp name="ThreadGroup.duration"></stringProp>
        <stringProp name="ThreadGroup.delay"></stringProp>
      </PostThreadGroup>
      <hashTree>
        <JSR223Sampler guiclass="TestBeanGUI" testclass="JSR223Sampler" testname="JSR223S_stopTcpServer" enabled="true">
          <stringProp name="scriptLanguage">groovy</stringProp>
          <stringProp name="parameters"></stringProp>
          <stringProp name="filename"></stringProp>
          <stringProp name="cacheKey">81a419ad-5207-446a-b0a0-2bfe2cd776ed</stringProp>
          <stringProp name="script">import org.apache.jmeter.util.JMeterUtils;
import org.apache.mina.core.session.IoSession;
import org.apache.mina.core.service.IoAcceptor;

IoAcceptor acceptor = props.get(&quot;TCP_SERVER&quot;);
acceptor.setCloseOnDeactivation(true);
for (IoSession ss : acceptor.getManagedSessions().values()) {
  ss.close(true);
}
acceptor.unbind();
acceptor.dispose();</stringProp>
        </JSR223Sampler>
        <hashTree/>
      </hashTree>
      <ResultCollector guiclass="ViewResultsFullVisualizer" testclass="ResultCollector" testname="View Results Tree" enabled="true">
        <boolProp name="ResultCollector.error_logging">false</boolProp>
        <objProp>
          <name>saveConfig</name>
          <value class="SampleSaveConfiguration">
            <time>false</time>
            <latency>false</latency>
            <timestamp>false</timestamp>
            <success>true</success>
            <label>true</label>
            <code>true</code>
            <message>true</message>
            <threadName>true</threadName>
            <dataType>true</dataType>
            <encoding>false</encoding>
            <assertions>false</assertions>
            <subresults>false</subresults>
            <responseData>false</responseData>
            <samplerData>false</samplerData>
            <xml>false</xml>
            <fieldNames>true</fieldNames>
            <responseHeaders>false</responseHeaders>
            <requestHeaders>false</requestHeaders>
            <responseDataOnError>false</responseDataOnError>
            <saveAssertionResultsFailureMessage>false</saveAssertionResultsFailureMessage>
            <assertionsResultsToSave>0</assertionsResultsToSave>
            <threadCounts>true</threadCounts>
            <sampleCount>true</sampleCount>
          </value>
        </objProp>
        <stringProp name="filename">TCP_TESTS.csv</stringProp>
      </ResultCollector>
      <hashTree/>
      <ResultCollector guiclass="SimpleDataWriter" testclass="ResultCollector" testname="Simple Data Writer" enabled="true">
        <boolProp name="ResultCollector.error_logging">false</boolProp>
        <objProp>
          <name>saveConfig</name>
          <value class="SampleSaveConfiguration">
            <time>false</time>
            <latency>false</latency>
            <timestamp>false</timestamp>
            <success>true</success>
            <label>true</label>
            <code>true</code>
            <message>true</message>
            <threadName>true</threadName>
            <dataType>true</dataType>
            <encoding>false</encoding>
            <assertions>true</assertions>
            <subresults>true</subresults>
            <responseData>false</responseData>
            <samplerData>false</samplerData>
            <xml>true</xml>
            <fieldNames>false</fieldNames>
            <responseHeaders>false</responseHeaders>
            <requestHeaders>false</requestHeaders>
            <responseDataOnError>false</responseDataOnError>
            <saveAssertionResultsFailureMessage>false</saveAssertionResultsFailureMessage>
            <assertionsResultsToSave>0</assertionsResultsToSave>
            <threadCounts>true</threadCounts>
            <sampleCount>true</sampleCount>
          </value>
        </objProp>
        <stringProp name="filename">TCP_TESTS.xml</stringProp>
      </ResultCollector>
      <hashTree/>
    </hashTree>
    <WorkBench guiclass="WorkBenchGui" testclass="WorkBench" testname="WorkBench" enabled="true">
      <boolProp name="WorkBench.save">true</boolProp>
    </WorkBench>
    <hashTree>
      <ConfigTestElement guiclass="PropertyControlGui" testclass="ConfigTestElement" testname="Property Display" enabled="true"/>
      <hashTree/>
    </hashTree>
  </hashTree>
</jmeterTestPlan>
