Support for costom cookie store

Related to #1187

This makes it possible to exchange cookie store.