Buggy code:
private static final String SSLCONTEXT_PROTOCOL = JMeterUtils . getPropDefault ( "proxy.ssl.protocol" , "SSLv3" ) ; private static final HashMap < String , SSLSocketFactory > hashHost = new HashMap < String , SSLSocketFactory > ( ) ; private static final String CERT_DIRECTORY = JMeterUtils . getPropDefault ( "proxy.cert.directory" , JMeterUtils . getJMeterBinDir ( ) ) ; private static final String CERT_FILE_DEFAULT = "proxyserver.jks" ; private static final String CERT_FILE = JMeterUtils . getPropDefault ( "proxy.cert.file" , Proxy . CERT_FILE_DEFAULT ) ; 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 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 ( ) ; HTTPSamplerBase sampler = HTTPSamplerFactory . newInstance ( httpSamplerName ) ; HttpRequestHdr request = new HttpRequestHdr ( sampler ) ; SampleResult result = null ; HeaderManager headers = 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 ( ) ) ) ; } request . getSampler ( 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 = generateErrorResult ( result , uhe ) ; } catch ( IllegalArgumentException e ) { Proxy . log . error ( "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:////jakarta.apache.org//jmeter//usermanual//component_reference.html#HTTP_Proxy_Server\">HTTP<seq2seq4repair_space>Proxy<seq2seq4repair_space>Server<seq2seq4repair_space>documentation<//a>" ) ) ) ) ; <END_BUG> result = generateErrorResult ( result , e ) ; } catch ( IOException ioe ) { 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 ( ) ) ) ) ; 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 = generateErrorResult ( result , e ) ; } finally { if ( Proxy . log . isDebugEnabled ( ) ) { 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 ) ; } } target . deliverSampler ( sampler , new TestElement [ ] { captureHttpHeaders ? headers : null } , result ) ; try { clientSocket . close ( ) ; } catch ( Exception e ) { Proxy . log . error ( "" , e ) ; } sampler . threadFinished ( ) ; } } private SSLSocketFactory getSSLSocketFactory ( String host ) throws IOException { } private Socket startSSL ( Socket sock , String host ) throws IOException { } private InputStream getCertificate ( ) { } private SampleResult generateErrorResult ( SampleResult result , Exception e ) { }

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_Proxy_Server\">HTTP<seq2seq4repair_space>Proxy<seq2seq4repair_space>Server<seq2seq4repair_space>documentation<//a>" ) ) ) ) ;