Buggy code:
@ Override public void run ( ) { String httpSamplerName = target . getSamplerTypeName ( ) ; HttpRequestHdr request = new HttpRequestHdr ( httpSamplerName ) ; SampleResult result = null ; HeaderManager headers = null ; HTTPSamplerBase sampler = null ; Proxy . log . debug ( ( ( port ) + "====================================================================" ) ) ; try { byte [ ] ba = request . parse ( new BufferedInputStream ( clientSocket . getInputStream ( ) ) ) ; if ( ( ba . length ) == 0 ) { Proxy . log . warn ( ( ( port ) + "Empty<seq2seq4repair_space>request,<seq2seq4repair_space>ignored" ) ) ; throw new JMeterException ( ) ; } if ( Proxy . log . isDebugEnabled ( ) ) { Proxy . log . debug ( ( ( ( port ) + "Initial<seq2seq4repair_space>request:<seq2seq4repair_space>" ) + ( new String ( ba ) ) ) ) ; } outStreamClient = clientSocket . getOutputStream ( ) ; if ( ( request . getMethod ( ) . startsWith ( CONNECT ) ) && ( ( outStreamClient ) != null ) ) { Proxy . log . debug ( ( ( port ) + "Method<seq2seq4repair_space>CONNECT<seq2seq4repair_space>=><seq2seq4repair_space>SSL" ) ) ; outStreamClient . write ( "HTTP//1.0<seq2seq4repair_space>200<seq2seq4repair_space>OK\r\n\r\n" . getBytes ( DEFAULT_HTTP_ENCODING ) ) ; outStreamClient . flush ( ) ; String [ ] param = request . getUrl ( ) . split ( ":" ) ; if ( ( param . length ) == 2 ) { Proxy . log . debug ( ( ( ( port ) + "Start<seq2seq4repair_space>to<seq2seq4repair_space>negotiate<seq2seq4repair_space>SSL<seq2seq4repair_space>connection,<seq2seq4repair_space>host:<seq2seq4repair_space>" ) + ( param [ 0 ] ) ) ) ; clientSocket = startSSL ( clientSocket , param [ 0 ] ) ; } else { Proxy . log . error ( ( "In<seq2seq4repair_space>SSL<seq2seq4repair_space>request,<seq2seq4repair_space>unable<seq2seq4repair_space>to<seq2seq4repair_space>find<seq2seq4repair_space>host<seq2seq4repair_space>and<seq2seq4repair_space>port<seq2seq4repair_space>in<seq2seq4repair_space>CONNECT<seq2seq4repair_space>request:<seq2seq4repair_space>" + ( request . getUrl ( ) ) ) ) ; throw new JMeterException ( ) ; } try { ba = request . parse ( new BufferedInputStream ( clientSocket . getInputStream ( ) ) ) ; } catch ( IOException ioe ) { final String url = ( ( param . length ) > 0 ) ? ( "<seq2seq4repair_space>for<seq2seq4repair_space>'" + ( param [ 0 ] ) ) + "'" : "" ; Proxy . log . warn ( ( ( ( ( ( port ) + "Problem<seq2seq4repair_space>with<seq2seq4repair_space>SSL<seq2seq4repair_space>certificate" ) + url ) + "?<seq2seq4repair_space>Ensure<seq2seq4repair_space>browser<seq2seq4repair_space>is<seq2seq4repair_space>set<seq2seq4repair_space>to<seq2seq4repair_space>accept<seq2seq4repair_space>the<seq2seq4repair_space>JMeter<seq2seq4repair_space>proxy<seq2seq4repair_space>cert:<seq2seq4repair_space>" ) + ( ioe . getMessage ( ) ) ) ) ; result = Proxy . generateErrorResult ( result , request , ioe , "\n**ensure<seq2seq4repair_space>browser<seq2seq4repair_space>is<seq2seq4repair_space>set<seq2seq4repair_space>to<seq2seq4repair_space>accept<seq2seq4repair_space>the<seq2seq4repair_space>JMeter<seq2seq4repair_space>proxy<seq2seq4repair_space>certificate**" ) ; throw new JMeterException ( ) ; } if ( Proxy . log . isDebugEnabled ( ) ) { Proxy . log . debug ( ( ( ( port ) + "Reparse:<seq2seq4repair_space>" ) + ( new String ( ba ) ) ) ) ; } if ( ( ba . length ) == 0 ) { Proxy . log . warn ( ( ( ( port ) + "Empty<seq2seq4repair_space>response<seq2seq4repair_space>to<seq2seq4repair_space>http<seq2seq4repair_space>over<seq2seq4repair_space>SSL.<seq2seq4repair_space>Probably<seq2seq4repair_space>waiting<seq2seq4repair_space>for<seq2seq4repair_space>user<seq2seq4repair_space>to<seq2seq4repair_space>authorize<seq2seq4repair_space>the<seq2seq4repair_space>certificate<seq2seq4repair_space>for<seq2seq4repair_space>" ) + ( request . getUrl ( ) ) ) ) ; throw new JMeterException ( ) ; } } SamplerCreator samplerCreator = Proxy . SAMPLERFACTORY . getSamplerCreator ( request , pageEncodings , formEncodings ) ; sampler = samplerCreator . createAndPopulateSampler ( request , pageEncodings , formEncodings ) ; headers = request . getHeaderManager ( ) ; sampler . setHeaderManager ( headers ) ; sampler . threadStarted ( ) ; if ( Proxy . log . isDebugEnabled ( ) ) { Proxy . log . debug ( ( ( ( ( ( port ) + "Execute<seq2seq4repair_space>sample:<seq2seq4repair_space>" ) + ( sampler . getMethod ( ) ) ) + "<seq2seq4repair_space>" ) + ( sampler . getUrl ( ) ) ) ) ; } result = sampler . sample ( ) ; String pageEncoding = addPageEncoding ( result ) ; addFormEncodings ( result , pageEncoding ) ; writeToClient ( result , new BufferedOutputStream ( clientSocket . getOutputStream ( ) ) ) ; samplerCreator . postProcessSampler ( sampler , result ) ; } catch ( JMeterException jme ) { } catch ( UnknownHostException uhe ) { Proxy . log . warn ( ( ( port ) + "Server<seq2seq4repair_space>Not<seq2seq4repair_space>Found." ) , uhe ) ; writeErrorToClient ( HttpReplyHdr . formServerNotFound ( ) ) ; result = generateErrorResult ( result , request , uhe ) ; } catch ( IllegalArgumentException e ) { Proxy . log . error ( ( ( port ) + "Not<seq2seq4repair_space>implemented<seq2seq4repair_space>(probably<seq2seq4repair_space>used<seq2seq4repair_space>https)" ) , e ) ; <START_BUG> writeErrorToClient ( HttpReplyHdr . formNotImplemented ( ( "Probably<seq2seq4repair_space>used<seq2seq4repair_space>https<seq2seq4repair_space>instead<seq2seq4repair_space>of<seq2seq4repair_space>http.<seq2seq4repair_space>" + ( "To<seq2seq4repair_space>record<seq2seq4repair_space>https<seq2seq4repair_space>requests,<seq2seq4repair_space>see<seq2seq4repair_space>" + "<a<seq2seq4repair_space>href=\"http:////jmeter.apache.org//usermanual//component_reference.html#HTTP_Proxy_Server\">HTTP<seq2seq4repair_space>Proxy<seq2seq4repair_space>Server<seq2seq4repair_space>documentation<//a>" ) ) ) ) ; <END_BUG> result = generateErrorResult ( result , request , e ) ; } catch ( Exception e ) { Proxy . log . error ( ( ( port ) + "Exception<seq2seq4repair_space>when<seq2seq4repair_space>processing<seq2seq4repair_space>sample" ) , e ) ; writeErrorToClient ( HttpReplyHdr . formInternalError ( ) ) ; result = generateErrorResult ( result , request , e ) ; } finally { if ( Proxy . log . isDebugEnabled ( ) ) { if ( sampler != null ) { Proxy . log . debug ( ( ( ( port ) + "Will<seq2seq4repair_space>deliver<seq2seq4repair_space>sample<seq2seq4repair_space>" ) + ( sampler . getName ( ) ) ) ) ; } } if ( headers != null ) { headers . removeHeaderNamed ( HEADER_COOKIE ) ; headers . removeHeaderNamed ( HEADER_AUTHORIZATION ) ; for ( String hdr : Proxy . HEADERS_TO_REMOVE ) { headers . removeHeaderNamed ( hdr ) ; } } if ( result != null ) { target . deliverSampler ( sampler , new TestElement [ ] { captureHttpHeaders ? headers : null } , result ) ; } try { clientSocket . close ( ) ; } catch ( Exception e ) { Proxy . log . error ( ( ( port ) + "Failed<seq2seq4repair_space>to<seq2seq4repair_space>close<seq2seq4repair_space>client<seq2seq4repair_space>socket" ) , e ) ; } if ( sampler != null ) { sampler . threadFinished ( ) ; } } } private SSLSocketFactory getSSLSocketFactory ( String host ) { } private String getDomainMatch ( KeyStore keyStore , String host ) throws KeyStoreException { } private KeyManager [ ] getWrappedKeyManagers ( final String keyAlias ) throws IOException , GeneralSecurityException { }

Fix:
writeErrorToClient ( HttpReplyHdr . formNotImplemented ( ( "Probably<seq2seq4repair_space>used<seq2seq4repair_space>https<seq2seq4repair_space>instead<seq2seq4repair_space>of<seq2seq4repair_space>http.<seq2seq4repair_space>" + ( "To<seq2seq4repair_space>record<seq2seq4repair_space>https<seq2seq4repair_space>requests,<seq2seq4repair_space>see<seq2seq4repair_space>" + "<a<seq2seq4repair_space>href=\"http:////jmeter.apache.org//usermanual//component_reference.html#HTTP(S)_Test_Script_Recorder\">HTTP(S)<seq2seq4repair_space>Test<seq2seq4repair_space>Script<seq2seq4repair_space>Recorder<seq2seq4repair_space>documentation<//a>" ) ) ) ) ;