have a look at Mega-WiFi_R3_ATmega2560_ESP8266
also arduino-mega-at2560-with-integrated-esp8266-wifi-how-to-connect