Overriding existing sessions

How do I use session overide in desired capabilities through code not on command line?