@Override
        void buildMessage() {
            int domainBytesLength = 0;
            if ( domainBytes != null ) {
                domainBytesLength = domainBytes.length;
            }
            int hostBytesLength = 0;
            if ( hostBytes != null ) {
                hostBytesLength = hostBytes.length;
            }

            // Now, build the message. Calculate its length first, including
            // signature or type.
            final int finalLength = 32 + 8 + hostBytesLength + domainBytesLength;

            // Set up the response. This will initialize the signature, message
            // type, and flags.
            prepareResponse(finalLength, 1);

            // Flags. These are the complete set of flags we support.
            addULong(flags);

            // Domain length (two times).
            addUShort(domainBytesLength);
            addUShort(domainBytesLength);

            // Domain offset.
            addULong(hostBytesLength + 32 + 8);

            // Host length (two times).
            addUShort(hostBytesLength);
            addUShort(hostBytesLength);

            // Host offset (always 32 + 8).
            addULong(32 + 8);

            // Version
            addUShort(0x0105);
            // Build
            addULong(2600);
            // NTLM revision
            addUShort(0x0f00);

            // Host (workstation) String.
            if (hostBytes != null) {
                addBytes(hostBytes);
            }
            // Domain String.
            if (domainBytes != null) {
                addBytes(domainBytes);
            }
        }
Getting the response involves building the message before returning
it
httpclient5/src/main/java/org/apache/hc/client5/http/impl/auth/NTLMEngineImpl.java