public Header authenticate(Credentials paramCredentials, HttpRequest paramHttpRequest) { while (true) { NTCredentials localNTCredentials; String str; CharArrayBuffer localCharArrayBuffer; try { localNTCredentials = (NTCredentials)paramCredentials; if ((this.state == State.CHALLENGE_RECEIVED) || (this.state == State.FAILED)) { str = this.engine.generateType1Msg(localNTCredentials.getDomain(), localNTCredentials.getWorkstation()); this.state = State.MSG_TYPE1_GENERATED; localCharArrayBuffer = new CharArrayBuffer(32); if (!isProxy()) break label222; localCharArrayBuffer.append("Proxy-Authorization"); localCharArrayBuffer.append(": NTLM "); localCharArrayBuffer.append(str); return new BufferedHeader(localCharArrayBuffer); } } catch (ClassCastException localClassCastException) { throw new InvalidCredentialsException("Credentials cannot be used for NTLM authentication: " + paramCredentials.getClass().getName()); } if (this.state == State.MSG_TYPE2_RECEVIED) { str = this.engine.generateType3Msg(localNTCredentials.getUserName(), localNTCredentials.getPassword(), localNTCredentials.getDomain(), localNTCredentials.getWorkstation(), this.challenge); this.state = State.MSG_TYPE3_GENERATED; } else { throw new AuthenticationException("Unexpected state: " + this.state); label222: localCharArrayBuffer.append("Authorization"); } } }