Buggy code:
private static final char [ ] KEYSTORE_PASSWORD = JMeterUtils . getPropDefault ( "proxy.cert.keystorepass" , "password" ) . toCharArray ( ) ; private static final char [ ] KEY_PASSWORD = JMeterUtils . getPropDefault ( "proxy.cert.keypassword" , "password" ) . toCharArray ( ) ; private static final SamplerCreatorFactory factory = new SamplerCreatorFactory ( ) ; private static final Pattern COOKIE_SECURE_PATTERN = Pattern . compile ( "\\bsecure\\b" , Pattern . CASE_INSENSITIVE ) ; private OutputStream outStreamClient = null ; private Socket clientSocket = null ; private ProxyControl target ; private boolean captureHttpHeaders ; private boolean httpsSpoof ; private String httpsSpoofMatch ; private Map < String , String > pageEncodings ; private Map < String , String > formEncodings ; public Proxy ( ) { } void configure ( Socket _clientSocket , ProxyControl _target , Map < String , String > _pageEncodings , Map < String , String > _formEncodings ) { } @ Override public void run ( ) { String httpSamplerName = target . getSamplerTypeName ( ) ; HttpRequestHdr request = new HttpRequestHdr ( httpSamplerName ) ; SampleResult result = null ; HeaderManager headers = null ; HTTPSamplerBase sampler = null ; try { request . parse ( new BufferedInputStream ( clientSocket . getInputStream ( ) ) ) ; outStreamClient = clientSocket . getOutputStream ( ) ; if ( ( request . getMethod ( ) . startsWith ( CONNECT ) ) && ( ( outStreamClient ) != null ) ) { Proxy . log . debug ( "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 ( ( "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 . warn ( "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" ) ; } request . parse ( new BufferedInputStream ( clientSocket . getInputStream ( ) ) ) ; } SamplerCreator samplerCreator = Proxy . factory . getSamplerCreator ( request , pageEncodings , formEncodings ) ; sampler = samplerCreator . createSampler ( request , pageEncodings , formEncodings ) ; samplerCreator . populateSampler ( sampler , request , pageEncodings , formEncodings ) ; headers = request . getHeaderManager ( ) ; sampler . setHeaderManager ( headers ) ; boolean forcedHTTPS = false ; if ( httpsSpoof ) { if ( ( httpsSpoofMatch . length ( ) ) > 0 ) { String url = request . getUrl ( ) ; if ( url . matches ( httpsSpoofMatch ) ) { sampler . setProtocol ( PROTOCOL_HTTPS ) ; forcedHTTPS = true ; } } else { sampler . setProtocol ( PROTOCOL_HTTPS ) ; forcedHTTPS = true ; } } sampler . threadStarted ( ) ; result = sampler . sample ( ) ; if ( ( httpsSpoof ) && ( TEXT . equals ( result . getDataType ( ) ) ) ) { final String enc = result . getDataEncodingWithDefault ( ) ; String noHttpsResult = new String ( result . getResponseData ( ) , enc ) ; final String HTTPS_HOST = ( "https:////([^://]+)(:" + ( HTTPConstants . DEFAULT_HTTPS_PORT_STRING ) ) + ")?" ; noHttpsResult = noHttpsResult . replaceAll ( HTTPS_HOST , "http:////$1" ) ; result . setResponseData ( noHttpsResult . getBytes ( enc ) ) ; } String pageEncoding = addPageEncoding ( result ) ; addFormEncodings ( result , pageEncoding ) ; writeToClient ( result , new BufferedOutputStream ( clientSocket . getOutputStream ( ) ) , forcedHTTPS ) ; } catch ( UnknownHostException uhe ) { Proxy . log . warn ( "Server<seq2seq4repair_space>Not<seq2seq4repair_space>Found." , uhe ) ; writeErrorToClient ( HttpReplyHdr . formServerNotFound ( ) ) ; result = Proxy . generateErrorResult ( result , uhe ) ; } catch ( IllegalArgumentException e ) { Proxy . log . error ( "Not<seq2seq4repair_space>implemented<seq2seq4repair_space>(probably<seq2seq4repair_space>used<seq2seq4repair_space>https)" , e ) ; 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>" ) ) ) ) ; result = Proxy . generateErrorResult ( result , e ) ; } catch ( IOException ioe ) { <START_BUG> Proxy . log . error ( ( "Problem<seq2seq4repair_space>with<seq2seq4repair_space>SSL<seq2seq4repair_space>certificate?<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 . getLocalizedMessage ( ) ) ) ) ; <END_BUG> if ( result == null ) { result = new SampleResult ( ) ; result . setSampleLabel ( "Sample<seq2seq4repair_space>failed" ) ; } result . setResponseMessage ( ( ( ioe . getMessage ( ) ) + "\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**" ) ) ; } catch ( Exception e ) { Proxy . log . error ( "Exception<seq2seq4repair_space>when<seq2seq4repair_space>processing<seq2seq4repair_space>sample" , e ) ; writeErrorToClient ( HttpReplyHdr . formInternalError ( ) ) ; result = Proxy . generateErrorResult ( result , e ) ; } finally { boolean samplerAvailable = sampler != null ; if ( Proxy . log . isDebugEnabled ( ) ) { if ( samplerAvailable ) { Proxy . log . debug ( ( "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 . headersToRemove ) { headers . removeHeaderNamed ( hdr ) ; } } if ( samplerAvailable ) { target . deliverSampler ( sampler , new TestElement [ ] { captureHttpHeaders ? headers : null } , result ) ; } try { clientSocket . close ( ) ; } catch ( Exception e ) { Proxy . log . error ( "" , e ) ; } if ( samplerAvailable ) { sampler . threadFinished ( ) ; } } } private SSLSocketFactory getSSLSocketFactory ( String host ) throws IOException { } private Socket startSSL ( Socket sock , String host ) throws IOException { } private InputStream getCertificate ( ) { } private static SampleResult generateErrorResult ( SampleResult result , Exception e ) { }

Fix:
Proxy . log . error ( ( "Problem<seq2seq4repair_space>with<seq2seq4repair_space>SSL<seq2seq4repair_space>certificate?<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 . getLocalizedMessage ( ) ) ) , ioe ) ;