public static function isConnected($conn)
    {
        return (is_null($conn) !== true &&
                is_resource($conn) === true &&
                strtolower(get_resource_type($conn)) == 'socket');
    }