There are two problems with shouting (by the way i do do it too sometimes!!) - firstly, that you have lost control and they can probably sense that. And secondly that when we do it we are demonstrating that the way to get people to do what you want is to intimidate them or shout at them.
Your 6 yo is testing the boundaries like you say. Our 6 yo DD does this too. If you can, see it as part of his normal development - something he needs to do as he becomes mmore independant - and see if that helps you stay calm and in control. He needs to know you're in charge.
Choose your battles - think about what behaviours really matter and what don't that much, then only say no to the things that really matter. Try and make a list of the nos and keep it small - dangerous or violent behavior for eg. Once you say no, stick to it. Things that don't matter too much, just let them go. still praise when he does do them, still be imaginative and make them fun (really hard work that bit I know!!) And think of ways for him to have more control - eg choose what he has for breakfast, what clothes he wears, etc.
Also ask yourself sometimes is he actually behaving younger than is real age - needing to be babied a bit - if so, let him be a bit. i wouldn't do the pretending to walk off thing as this can make children really anxious - he needs to know you won't leave him. But you can introduce some natural consequences - for eg if he doesn't come now there won't be time for him to have a pudding / play after tea or whatever he normally does next. With our DD she loves bedtime story, so when she went through phases of messing about at bedtime we'd say there'll be no time for bedtime story if she doesn't do what she needs to straight away. usually give her two warnings / reminders then count to 3. We don't often get to 3!! Even this though all said in a calm reasonable voice rather than an angry one, which turns it into a confrontation.
Its so hard isn't it - and i only have one! but you are half way there just because you recognise its a problem and you're thinking about different ways to deal with it. give yourself a pat on the back 
if you are getting really stressed there is this book - you might be able to borrow from the library - called 'the explosive child' it explains why there's no point trying to reason with a child in meltdown and also has suggestions how to avoid them. i found it very useful and can probably be used for most children not just 'chronically inflexible' ones....
Good luck!