code: @Override
      public void handleResponse(final HttpProxyResponse response)
              throws ProxyAuthException {
          if (step == 0) {
              String challengeResponse = getNTLMHeader(response);
              step = 1;
  
              if (challengeResponse == null || challengeResponse.length() < 5) {
                  // Nothing to handle at this step. 
                  // Just need to send a reply type 1 message in doHandshake().
                  return;
              }
  
              // else there was no step 0 so continue to step 1.
          }
  
          if (step == 1) {
              // Header should look like :
              // Proxy-Authenticate: NTLM still_some_more_stuff
              String challengeResponse = getNTLMHeader(response);
  
              if (challengeResponse == null || challengeResponse.length() < 5) {
                  throw new ProxyAuthException(
                          "Unexpected error while reading server challenge !");
              }
  
              try {
                  challengePacket = Base64
                          .decodeBase64(challengeResponse.substring(5).getBytes(
                                  proxyIoSession.getCharsetName()));
              } catch (IOException e) {
                  throw new ProxyAuthException(
                          "Unable to decode the base64 encoded NTLM challenge", e);
              }
              step = 2;
          } else {
              throw new ProxyAuthException("Received unexpected response code ("
                      + response.getStatusLine() + ").");
          }
      }
docs: {@inheritDoc}