Buggy code:
public class TCPSampler extends AbstractSampler implements ThreadListener { private static final Logger log = LoggingManager . getLoggerForClass ( ) ; public static final String SERVER = "TCPSampler.server" ; public static final String PORT = "TCPSampler.port" ; public static final String FILENAME = "TCPSampler.filename" ; public static final String CLASSNAME = "TCPSampler.classname" ; public static final String NODELAY = "TCPSampler.nodelay" ; public static final String TIMEOUT = "TCPSampler.timeout" ; public static final String REQUEST = "TCPSampler.request" ; private static final String TCPKEY = "TCP" ; private static final String ERRKEY = "ERR" ; private static final String STATUS_PREFIX = JMeterUtils . getPropDefault ( "tcp.status.prefix" , "" ) ; private static final String STATUS_SUFFIX = JMeterUtils . getPropDefault ( "tcp.status.suffix" , "" ) ; private static final String STATUS_PROPERTIES = JMeterUtils . getPropDefault ( "tcp.status.properties" , "" ) ; private static final Properties statusProps = new Properties ( ) ; private static boolean haveStatusProps = false ; private static ThreadLocal tp = new ThreadLocal ( ) { protected Object initialValue ( ) { } } ; private transient TCPClient protocolHandler ; public TCPSampler ( ) { } private String getError ( ) { } private Socket getSocket ( ) { } public String getUsername ( ) { } public String getPassword ( ) { } public void setServer ( String newServer ) { } public String getServer ( ) { } public void setPort ( String newFilename ) { } public int getPort ( ) { } public void setFilename ( String newFilename ) { } public String getFilename ( ) { } public void setRequestData ( String newRequestData ) { } public String getRequestData ( ) { } public void setTimeout ( String newTimeout ) { } public int getTimeout ( ) { } public void setNoDelay ( String newNoDelay ) { } public boolean getNoDelay ( ) { } public String getLabel ( ) { } private static String getClassname ( ) { } private static final String protoPrefix = "org.apache.jmeter.protocol.tcp.sampler." ; private Class getClass ( String className ) { } private TCPClient getProtocol ( ) { } public SampleResult sample ( Entry e ) { TCPSampler . log . debug ( ( ( ( ( ( ( ( getLabel ( ) ) + "<seq2seq4repair_space>" ) + ( getFilename ( ) ) ) + "<seq2seq4repair_space>" ) + ( getUsername ( ) ) ) + "<seq2seq4repair_space>" ) + ( getPassword ( ) ) ) ) ; SampleResult res = new SampleResult ( ) ; boolean isSuccessful = false ; res . setSampleLabel ( getName ( ) ) ; res . setSamplerData ( ( ( ( "Host:<seq2seq4repair_space>" + ( getServer ( ) ) ) + "<seq2seq4repair_space>Port:<seq2seq4repair_space>" ) + ( getPort ( ) ) ) ) ; res . sampleStart ( ) ; try { Socket sock = getSocket ( ) ; if ( sock == null ) { res . setResponseCode ( "500" ) ; res . setResponseMessage ( getError ( ) ) ; } else { InputStream is = sock . getInputStream ( ) ; OutputStream os = sock . getOutputStream ( ) ; String req = getRequestData ( ) ; res . setSamplerData ( req ) ; protocolHandler . write ( os , req ) ; String in = protocolHandler . read ( is ) ; res . setResponseData ( in . getBytes ( ) ) ; res . setDataType ( TEXT ) ; <START_BUG> res . setResponseCode ( "200" ) ; <END_BUG> res . setResponseMessage ( "OK" ) ; isSuccessful = true ; if ( ( TCPSampler . STATUS_PREFIX . length ( ) ) > 0 ) { int i = in . indexOf ( TCPSampler . STATUS_PREFIX ) ; int j = in . indexOf ( TCPSampler . STATUS_SUFFIX , ( i + ( TCPSampler . STATUS_PREFIX . length ( ) ) ) ) ; if ( ( i != ( - 1 ) ) && ( j > i ) ) { String rc = in . substring ( ( i + ( TCPSampler . STATUS_PREFIX . length ( ) ) ) , j ) ; res . setResponseCode ( rc ) ; isSuccessful = checkResponseCode ( rc ) ; if ( TCPSampler . haveStatusProps ) { res . setResponseMessage ( TCPSampler . statusProps . getProperty ( rc , "Status<seq2seq4repair_space>code<seq2seq4repair_space>not<seq2seq4repair_space>found<seq2seq4repair_space>in<seq2seq4repair_space>properties" ) ) ; } else { res . setResponseMessage ( "No<seq2seq4repair_space>status<seq2seq4repair_space>property<seq2seq4repair_space>file" ) ; } } else { res . setResponseCode ( "999" ) ; res . setResponseMessage ( "Status<seq2seq4repair_space>value<seq2seq4repair_space>not<seq2seq4repair_space>found" ) ; isSuccessful = false ; } } } } catch ( IOException ex ) { TCPSampler . log . debug ( "" , ex ) ; res . setResponseCode ( "500" ) ; res . setResponseMessage ( ex . toString ( ) ) ; closeSocket ( ) ; } finally { res . sampleEnd ( ) ; res . setSuccessful ( isSuccessful ) ; } return res ; } private boolean checkResponseCode ( String rc ) { } public void threadStarted ( ) { } private void closeSocket ( ) { } public void threadFinished ( ) { } }

Fix:
res . setResponseCodeOK ( ) ;