buf.writeByte(X224_TPDU_CONNECTION_REQUEST);
buf.writeShort(0); // Destination reference = 0
buf.writeShort(0); // Source reference = 0
buf.writeByte(0); // Class and options = 0
buf.writeString("Cookie: mstshash=" + userName + "\r\n", RdpConstants.CHARSET_8); // Cookie
// RDP_NEG_REQ::type
buf.writeByte(RdpConstants.RDP_NEG_REQ_TYPE_NEG_REQ);
// RDP_NEG_REQ::flags (0)
buf.writeByte(RdpConstants.RDP_NEG_REQ_FLAGS);