/// <summary>
        /// It starts/ creates new session for Lens(JobMine).
        /// If lens(DEXRay) seesion is created, returns true
        /// Else, returns false
        /// </summary>
        /// <param name="host"></param>
        /// <param name="port"></param>
        /// <param name="encodingValue"></param>
        /// <param name="version"></param>
        /// <param name="sessiontimeout"></param>
        /// <returns></returns>
        private static bool OpenJobMineSrvrSession(string host, UInt32 port, string encodingValue, string version, ulong sessiontimeout)
        {
            Utils utils = new Utils();

            utils.logger.Debug("Opening a session for JobMine V" + version + "...");
            mDESession = MSLens.CreateSession(host, port, Encoding.GetEncoding(encodingValue));
            mDESession.SetEnableTransactionTimeout(true);
            mDESession.SetTransactionTimeout(sessiontimeout); // 1 minute
            mDESession.Open();
            utils.logger.Debug(("created") + " a session for JobMine V" + version + " currently.");
            return(true);
        }
        private string AttemptSend(string method, byte[] data, string docType)
        {
            EventSource.Raise(Event.MethodEnter, method, Event.Arg("data", data), Event.Arg("docType", docType));

            string response = null;

            try
            {
                if (!LensSession.IsOpen())
                {
                    LensSession.Open();
                }

                EventSource.Raise(Event.Information, method, "Sending request to Lens.", Event.Arg("Host", LensSession.GetHost()), Event.Arg("Port", LensSession.GetPort()), Event.Arg("Timeout", Timeout));

                response = TagResume(data, docType);

                EventSource.Raise(Event.Information, method, "Received response from Lens.", Event.Arg("Response", response));

                ParseForErrors(response);
                return(response);
            }
            catch (LensException ex)
            {
                EventSource.Raise(Event.Error, method, ex, null, Event.Arg("data", data), Event.Arg("docType", docType), Event.Arg("response", response));
                throw;
            }
            catch (Exception ex)
            {
                EventSource.Raise(Event.Error, method, ex, null, Event.Arg("data", data), Event.Arg("docType", docType), Event.Arg("response", response));

                if (ex.InnerException is SocketException)
                {
                    throw new LensUnavailableException(string.Format("Failed to connect to Lens server {0}:{1}.", LensSession.GetHost(), LensSession.GetPort()), ex);
                }
                else if (ex.InnerException is XmlException)
                {
                    throw new LensXmlInvalidException("The XML returned from Lens is invalid.", ex);
                }
                else
                {
                    throw new LensException(ex.Message, ex);
                }
            }
            finally
            {
                LensSession.Close();

                EventSource.Raise(Event.MethodExit, method, Event.Arg("data", data), Event.Arg("docType", docType), Event.Arg("response", response));
            }
        }