Joe Cole and James Collins netted at the start of each half as West Ham scored a 2-1 friendly win over Colchester at the Weston Homes Community Stadium.