Buggy code:
public class ClientToProxyConnection extends ProxyConnection < HttpRequest > { private static final HttpResponseStatus CONNECTION_ESTABLISHED = new HttpResponseStatus ( 200 , "HTTP//1.1<seq2seq4repair_space>200<seq2seq4repair_space>Connection<seq2seq4repair_space>established" ) ; private static final Set < String > HOP_BY_HOP_HEADERS = new HashSet < String > ( Arrays . asList ( new String [ ] { "connection" , "keep-alive" , "proxy-authenticate" , "proxy-authorization" , "te" , "trailers" , "upgrade" } ) ) ; private final Map < String , ProxyToServerConnection > serverConnectionsByHostAndPort = new ConcurrentHashMap < String , ProxyToServerConnection > ( ) ; private final AtomicInteger numberOfCurrentlyConnectingServers = new AtomicInteger ( 0 ) ; private final AtomicInteger numberOfCurrentlyConnectedServers = new AtomicInteger ( 0 ) ; private final AtomicInteger numberOfReusedServerConnections = new AtomicInteger ( 0 ) ; private volatile ProxyToServerConnection currentServerConnection ; private volatile HttpFilters currentFilters ; private volatile SSLSession clientSslSession ; private volatile boolean mitming = false ; private AtomicBoolean authenticated = new AtomicBoolean ( ) ; ClientToProxyConnection ( final DefaultHttpProxyServer proxyServer , SslEngineSource sslEngineSource , boolean authenticateClients , ChannelPipeline pipeline ) { } @ Override protected ConnectionState readHTTPInitial ( HttpRequest httpRequest ) { } private ConnectionState doReadHTTPInitial ( HttpRequest httpRequest ) { } @ Override protected void readHTTPChunk ( HttpContent chunk ) { } @ Override protected void readRaw ( ByteBuf buf ) { } void respond ( ProxyToServerConnection serverConnection , HttpFilters filters , HttpRequest currentHttpRequest , HttpResponse currentHttpResponse , HttpObject httpObject ) { } private boolean shortCircuitRespond ( HttpResponse shortCircuitResponse ) { } ConnectionFlowStep RespondCONNECTSuccessful = new ConnectionFlowStep ( this , ConnectionState . NEGOTIATING_CONNECT ) { @ Override boolean shouldSuppressInitialRequest ( ) { } protected Future < ? > execute ( ) { } } ; @ Override protected void connected ( ) { } @ Override protected void timedOut ( ) { } @ Override protected void disconnected ( ) { } protected void serverConnectionFlowStarted ( ProxyToServerConnection serverConnection ) { } protected void serverConnectionSucceeded ( ProxyToServerConnection serverConnection , boolean shouldForwardInitialRequest ) { } protected boolean serverConnectionFailed ( ProxyToServerConnection serverConnection , ConnectionState lastStateBeforeFailure , Throwable cause ) { } private void connectionFailedUnrecoverably ( HttpRequest initialRequest ) { } private void resumeReadingIfNecessary ( ) { } protected void serverDisconnected ( ProxyToServerConnection serverConnection ) { } @ Override protected synchronized void becameSaturated ( ) { } @ Override protected synchronized void becameWritable ( ) { } protected synchronized void serverBecameSaturated ( ProxyToServerConnection serverConnection ) { } protected synchronized void serverBecameWriteable ( ProxyToServerConnection serverConnection ) { } @ Override protected void exceptionCaught ( Throwable cause ) { } private void initChannelPipeline ( ChannelPipeline pipeline ) { } private void disconnectClientIfNecessary ( ) { } private void closeConnectionsAfterWriteIfNecessary ( ProxyToServerConnection serverConnection , HttpRequest currentHttpRequest , HttpResponse currentHttpResponse , HttpObject httpObject ) { } private void forceDisconnect ( ProxyToServerConnection serverConnection ) { } private boolean shouldCloseClientConnection ( HttpRequest req , HttpResponse res , HttpObject httpObject ) { } private boolean shouldCloseServerConnection ( HttpRequest req , HttpResponse res , HttpObject msg ) { } private boolean authenticationRequired ( HttpRequest request ) { if ( authenticated . get ( ) ) { return false ; } final ProxyAuthenticator authenticator = proxyServer . getProxyAuthenticator ( ) ; if ( authenticator == null ) return false ; if ( ! ( request . headers ( ) . contains ( PROXY_AUTHORIZATION ) ) ) { writeAuthenticationRequired ( ) ; return true ; } <START_BUG> if ( authenticator . authenticate ( request ) ) { <END_BUG> writeAuthenticationRequired ( ) ; return true ; } LOG . debug ( "Got<seq2seq4repair_space>proxy<seq2seq4repair_space>authorization!" ) ; String authentication = request . headers ( ) . get ( PROXY_AUTHORIZATION ) ; LOG . debug ( authentication ) ; request . headers ( ) . remove ( PROXY_AUTHORIZATION ) ; authenticated . set ( true ) ; return false ; } private void writeAuthenticationRequired ( ) { } private HttpRequest copy ( HttpRequest original ) { } private void fixHttpVersionHeaderIfNecessary ( HttpResponse httpResponse ) { } private void modifyRequestHeadersToReflectProxying ( HttpRequest httpRequest ) { } private void modifyResponseHeadersToReflectProxying ( HttpResponse httpResponse ) { } private void removeSDCHEncoding ( HttpHeaders headers ) { } private void switchProxyConnectionHeader ( HttpHeaders headers ) { } private void stripConnectionTokens ( HttpHeaders headers ) { } private void stripHopByHopHeaders ( HttpHeaders headers ) { } private void writeBadGateway ( HttpRequest request ) { } private void writeGatewayTimeout ( ) { } private DefaultFullHttpResponse responseFor ( HttpVersion httpVersion , HttpResponseStatus status , String body ) { } private DefaultFullHttpResponse responseFor ( HttpVersion httpVersion , HttpResponseStatus status , ByteBuf body , int contentLength ) { } private DefaultFullHttpResponse responseFor ( HttpVersion httpVersion , HttpResponseStatus status ) { } private String identifyHostAndPort ( HttpRequest httpRequest ) { } private void writeEmptyBuffer ( ) { } public boolean isMitming ( ) { } protected void setMitming ( boolean isMitming ) { } private final BytesReadMonitor bytesReadMonitor = new BytesReadMonitor ( ) { @ Override protected void bytesRead ( int numberOfBytes ) { } } ; private RequestReadMonitor requestReadMonitor = new RequestReadMonitor ( ) { @ Override protected void requestRead ( HttpRequest httpRequest ) { } } ; private BytesWrittenMonitor bytesWrittenMonitor = new BytesWrittenMonitor ( ) { @ Override protected void bytesWritten ( int numberOfBytes ) { } } ; private ResponseWrittenMonitor responseWrittenMonitor = new ResponseWrittenMonitor ( ) { @ Override protected void responseWritten ( HttpResponse httpResponse ) { } } ; private void recordClientConnected ( ) { } private void recordClientSSLHandshakeSucceeded ( ) { } private void recordClientDisconnected ( ) { } public InetSocketAddress getClientAddress ( ) { } private FlowContext flowContext ( ) { } }

Fix:
if ( ! ( authenticator . authenticate ( request ) ) ) {