protected function createSocket($hostname, $port, $timeout)
    {
        $socketHandle = @fsockopen($hostname, $port, $errno, $errstr, $timeout) ?: null;

        //verify handle
        if (null === $socketHandle) {
            throw new \RuntimeException(sprintf('Could not connect to socket. (%s)', $errstr));
        }

        return $socketHandle;
    }