33d32
< 
82d80
<      * @throws HttpException If the messages cannot be retrieved.
163,164c161,162
<         byte[] hostBytes = EncodingUtil.getBytes(host, DEFAULT_CHARSET);
<         byte[] domainBytes = EncodingUtil.getBytes(domain, DEFAULT_CHARSET);
---
>         byte[] hostBytes = EncodingUtil.getBytes(host, "ISO-8859-1");
>         byte[] domainBytes = EncodingUtil.getBytes(domain, "ISO-8859-1");
182,191c180,189
<         // Flags
<         // NOTE: flag reference:
<         // 0x8000 = negotiate always sign
<         // 0x2000 = client is sending workstation name
<         // 0x1000 = client is sending domain name
<         // 0x0200 = negotiate NTLM
<         // 0x0004 - Request Target, which requests that server send target
<         // 0x0001 = negotiate Unicode
< 
<         addByte(getUseNTLMv2() ? (byte) 0x05 : (byte) 0x01);
---
>         // Flags Set:
>         // Negotiate NTLM2 key
>         // Negotiate Always Sign
>         // Negotiate Workstation Supplied
>         // Negotiate Domain Supplied
>         // Negotiate NTLM key
>         // Request Target
>         // Negotiate OEM
>         // Negotiate Unicode
>         addByte(getUseNTLMv2() ? (byte) 0x07 : (byte) 0x01);
193c191
<         addByte((byte) 0x00);
---
>         addByte((byte) 0x08);
235c233
<         return getResponse();
---
> 		return getResponse();
252,255c250,259
<         // The targetInfo is the 8 bytes starting from the byte in position 40.
<         byte[] targetInfo = new byte[8];
<         for (int i = 0; i < 8; i++) {
<             targetInfo[i] = msg[i + 40];
---
> 
>         // Index 40 contains a pointer to the target info...
>         int targetBufOffset = 40;
>         short bufLen = toShort( msg, targetBufOffset ); // buf len
>         short alloc = toShort( msg, targetBufOffset+2 ); // allocated space
>         short offset = toShort( msg, targetBufOffset+4 ); // the offset of the target buffer
> 
>         byte[] targetInfo= new byte[ bufLen ];
>         for (int i= 0; i<bufLen; i++) {
>             targetInfo[i] = msg[i+offset];
260c264,276
<     /** 
---
>     /**
>      * Convert the byte pair at the specified offset to a short from little endian order
>      * @param bytes
>      * @param offset
>      * @return
>      */
>     private short toShort( byte[] bytes, int offset )
>     {
>         return (short) ( ( ( bytes[ offset+1 ] & 0xFF) << 8)
>             + ( bytes[ offset ] & 0xFF) );
>     }
> 
> 	/**
269d284
<      * @param nonce the 8 byte array the server sent.
375,384c390,395
<         // Flags
<         // NOTE: flag reference:
<         // 0x8000 = negotiate always sign
<         // 0x2000 = client is sending workstation name
<         // 0x1000 = client is sending domain name
<         // 0x0200 = negotiate NTLM
<         // 0x0004 - Request Target, which requests that server send target
<         // 0x0001 = negotiate Unicode
< 
<         addByte(getUseNTLMv2() ? (byte) 0x05 : (byte) 0x01);
---
>         // Flags Set
>         // Negotiate NTLM2 Key
>         // Negotiate Always Sign
>         // Negotiate NTLM Key
>         // Negotiate Unicode
>         addByte((byte) 0x01);
386c397
<         addByte((byte) 0x00);
---
>         addByte((byte) 0x08);
398,399c409
< 
<     /** 
---
>     /**
