The CALOCUBE project for a space based cosmic ray experiment: design, construction, and first performance of a high granularity calorimeter prototype