protected function getResponseMessage()
    {

        // read the first 4 bytes which include the length of the response
        $lengthEncoded = $this->client->read(4);

        if (strlen($lengthEncoded) < 4) {
            return new Message('', Message::TYPE_RESPONSE_VALUE);
        }

        $lengthInBytes = unpack('V1size', $lengthEncoded)['size'];

        if ($lengthInBytes <= 0) {
            return new Message('', Message::TYPE_RESPONSE_VALUE);
        }

        $responseData = $this->client->read($lengthInBytes);

        // return an empty message if the server did not send any response
        if (null === $responseData) {
            return new Message('', Message::TYPE_RESPONSE_VALUE);
        }

        $responseMessage = new Message();
        $responseMessage->initializeFromRconData($responseData);

        if ($lengthInBytes >= 4000) {
            $this->handleFragmentedResponse($responseMessage);
        }

        return $responseMessage;
    }