Can't connect to MQTT broker using SIM800

Hi all,
I’m interfacing SIM800 with STM32F4Discovery Board.
i have referred these tutorials
http://www.raviyp.com/mqtt-protocol-tutorial-using-sim900-sim800-modules-mqtt-over-tcp/
and built the CONNECT, PUBLISH and SUBSCRIBE packets accordingly.
I tried connecting to various brokers i.e mosquitto, DIoTy, Hivemq etc.
to start with I tried connecting with these brokers using SIM800 GSM Module and PC using USB/TTL converter. When I send the CONNECT packet to broker using AT+CIPSEND command, there is no response from server and connection is closed immediately. In one of the broker, sending the CONNECT packet, I get the response 20 02 00 00, and then connection is closed immediately. In one more broker, sending the CONNECT packet, I am not getting any response, but still the connection stays for a longer period of time. I also tried connecting to brokers using Transparent mode also, still the results are same.
what should I have been doing wrong?
any solution is invited?

When you get 20 02 00 00 which might be the connect acknowledgement packet you should send next publish or subscribe packet within a few seconds or it will timeout and close.