procedure TESNHolterServiceClient.Check(); var RequestParameters: TJSONObject; ResponseDataType: byte; ResponseData: TBytes; Response: TJSONObject; begin Lock.Enter(); try Connect(); try RequestParameters:=TJSONObject.Create(); try RequestParameters.AddPair('Type', 'Check'); //. Connection_WriteTypedData(Data_Type_JSON, TEncoding.UTF8.GetBytes(RequestParameters.ToString())); Connection_ReadTypedData(ResponseDataType, ResponseData); //. if (ResponseDataType <> Data_Type_JSON) then raise Exception.Create('response has incorrect data type'); //. => //. Response:=(TJSONObject.ParseJSONValue(TEncoding.UTF8.GetString(ResponseData)) as TJSONObject); try Response_Check(Response); finally Response.Destroy(); end; finally RequestParameters.Destroy(); end; finally Disconnect(); end; finally Lock.Leave(); end; end;