MultiSerial wont working with ESP8266.

Hi! I am trying to make communication PC <-> Arduino Mega <-> ESP8266 using two UART of arduino mega, but i cant get response from ESP8266. What i doing wrong?

That code are working (i get response from esp8266);

void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
Serial1.begin(9600);
}

void loop() {
Serial1.println(“AT”); //send “AT” command to ESP 8266
delay(500);
stat(); //get response //get responsr from ESP8266
}

void stat() {
while (Serial1.available()) {
int inByte = Serial1.read();
Serial.write(inByte);}
}

But this arent:

#include <dht.h>
dht DHT;
void setup() {
Serial.begin(9600);
Serial1.begin(9600);
}

void loop() {
delay(3000);
Serial1.println(“AT”); //send “AT” command to ESP 8266 (have to get “OK” response)
stat(); // I SHOULD GET RESPONSE, but nothing happend!
delay(300);
int chk = DHT.read22(2); //transmit DAta to Thingspeak
Serial1.println(“AT+CIPSTART=“TCP”,“184.106.153.149”,80”);
Serial.println(“now print:”);
Serial1.println(“AT+CIPMODE=1”);
delay(500);
Serial1.println(“AT+CIPSEND”);
delay(500);
Serial1.print(“GET https://api.thingspeak.com/update?api_key=*******************&field1=”);
Serial1.print(DHT.humidity,0);
Serial1.print("&field2=");
Serial1.println(DHT.temperature,0);
Serial1.print("+++");
Serial1.println(“AT+CIPCLOSE”);
delay(600000);
}

void stat(){
while (Serial1.available()){
int inByte=Serial1.read();
Serial.write(inByte);
}}

I actually found a reason - because i using non-determined packet, which closed by “+++”, it needs to add some delay, so ESP8266 can handle this statement, so this part of code:
Serial1.println(DHT.temperature,0);
Serial1.print("+++");
Serial1.println(“AT+CIPCLOSE”);
delay(600000);

should be like:
Serial1.println(DHT.temperature,0);
Serial1.print("+++");
delay(20);
Serial1.println(“AT+CIPCLOSE”);
delay(600000);