Buggy code:
public class HTTPSampler2 extends HTTPSamplerBase { private static final Logger log = LoggingManager . getLoggerForClass ( ) ; static final String PROXY_HOST = System . getProperty ( "http.proxyHost" , "" ) ; private static final String NONPROXY_HOSTS = System . getProperty ( "http.nonProxyHosts" , "" ) ; static final int PROXY_PORT = Integer . parseInt ( System . getProperty ( "http.proxyPort" , DEFAULT_HTTP_PORT_STRING ) ) ; static final String PROXY_USER = JMeterUtils . getPropDefault ( HTTP_PROXY_USER , "" ) ; static final String PROXY_PASS = JMeterUtils . getPropDefault ( HTTP_PROXY_PASS , "" ) ; static InetAddress localAddress = null ; private static final String localHost ; static final ThreadLocal httpClients = new ThreadLocal ( ) ; private static Set nonProxyHostFull = new HashSet ( ) ; private static List nonProxyHostSuffix = new ArrayList ( ) ; private static final int nonProxyHostSuffixSize ; static boolean isNonProxy ( String host ) { } private static boolean isPartialMatch ( String host ) { } public HTTPSampler2 ( ) { } private void sendPostData ( PostMethod post ) throws IOException { } HttpClient setupConnection ( URL u , HttpMethodBase httpMethod , HTTPSampleResult res ) throws IOException { String urlStr = u . toString ( ) ; URI uri = new URI ( urlStr , false ) ; String schema = uri . getScheme ( ) ; if ( ( schema == null ) || ( ( schema . length ( ) ) == 0 ) ) { schema = PROTOCOL_HTTP ; } Protocol protocol = Protocol . getProtocol ( schema ) ; String host = uri . getHost ( ) ; int port = uri . getPort ( ) ; HostConfiguration hc = new HostConfiguration ( ) ; hc . setHost ( host , port , protocol ) ; if ( ( HTTPSampler2 . localAddress ) != null ) { hc . setLocalAddress ( HTTPSampler2 . localAddress ) ; } Map map = ( ( Map ) ( HTTPSampler2 . httpClients . get ( ) ) ) ; HttpClient httpClient = ( ( HttpClient ) ( map . get ( hc ) ) ) ; if ( httpClient == null ) { httpClient = new HttpClient ( new SimpleHttpConnectionManager ( ) ) ; map . put ( hc , httpClient ) ; } if ( ( ( HTTPSampler2 . PROXY_HOST . length ( ) ) > 0 ) && ( ! ( HTTPSampler2 . isNonProxy ( host ) ) ) ) { if ( HTTPSampler2 . log . isDebugEnabled ( ) ) { HTTPSampler2 . log . debug ( ( ( ( "Setting<seq2seq4repair_space>proxy:<seq2seq4repair_space>" + ( HTTPSampler2 . PROXY_HOST ) ) + ":" ) + ( HTTPSampler2 . PROXY_PORT ) ) ) ; } hc . setProxy ( HTTPSampler2 . PROXY_HOST , HTTPSampler2 . PROXY_PORT ) ; if ( ( HTTPSampler2 . PROXY_USER . length ( ) ) > 0 ) { <START_BUG> httpClient . getState ( ) . setProxyCredentials ( new AuthScope ( HTTPSampler2 . PROXY_HOST , HTTPSampler2 . PROXY_PORT , null , AuthScope . ANY_SCHEME ) , new NTCredentials ( HTTPSampler2 . PROXY_USER , HTTPSampler2 . PROXY_PASS , null , "" ) ) ; <END_BUG> } } HttpMethodParams params = httpMethod . getParams ( ) ; params . setCookiePolicy ( IGNORE_COOKIES ) ; params . setVersion ( ( JMeterUtils . getPropDefault ( "httpclient.version" , "1.1" ) . equals ( "1.0" ) ? HttpVersion . HTTP_1_0 : HttpVersion . HTTP_1_1 ) ) ; params . setSoTimeout ( JMeterUtils . getPropDefault ( "httpclient.timeout" , 0 ) ) ; httpMethod . setFollowRedirects ( getAutoRedirects ( ) ) ; if ( getUseKeepAlive ( ) ) { httpMethod . setRequestHeader ( HEADER_CONNECTION , KEEP_ALIVE ) ; } else { httpMethod . setRequestHeader ( HEADER_CONNECTION , CONNECTION_CLOSE ) ; } String hdrs = setConnectionHeaders ( httpMethod , u , getHeaderManager ( ) ) ; String cookies = setConnectionCookie ( httpMethod , u , getCookieManager ( ) ) ; if ( res != null ) { res . setURL ( u ) ; res . setRequestHeaders ( hdrs ) ; res . setCookies ( cookies ) ; } setConnectionAuthorization ( httpClient , u , getAuthManager ( ) ) ; return httpClient ; } protected String getResponseHeaders ( HttpMethod method ) { } String setConnectionCookie ( HttpMethod method , URL u , CookieManager cookieManager ) { } String setConnectionHeaders ( HttpMethod method , URL u , HeaderManager headerManager ) { } void setConnectionAuthorization ( HttpClient client , URL u , AuthManager authManager ) { } protected HTTPSampleResult sample ( URL url , String method , boolean areFollowingRedirect , int frameDepth ) { } private void setPutHeaders ( PutMethod put ) throws IOException { } void saveConnectionCookies ( HttpMethod method , URL u , CookieManager cookieManager ) { } public void threadStarted ( ) { } public void threadFinished ( ) { } }

Fix:
httpClient . getState ( ) . setProxyCredentials ( new AuthScope ( HTTPSampler2 . PROXY_HOST , HTTPSampler2 . PROXY_PORT , null , AuthScope . ANY_SCHEME ) , new NTCredentials ( HTTPSampler2 . PROXY_USER , HTTPSampler2 . PROXY_PASS , HTTPSampler2 . localHost , "" ) ) ;