At first sight this insect got me confused. Was this the leaf-footed bug Holhymenia histrio? At second sight it wasn't. It turned out a wasp. A striking similarity frequent in nature in animals and plants, named mimicry. In this phenomenon there is a model and a mimic. The model is a conspicuous animal which is avoided by the predators because it is unpalatable or somewhat toxic. The mimic, since it is much alike, is confused with the model, and the probability to be predated upon decreases.
In this case the wasp is the model and the bug is the mimic. The photo below shows the bug.