Skip to content

Commit 1568c0f

Browse files
committed
Set test okHttpClient read timeout to 1 minute
1 parent ca56da0 commit 1568c0f

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

library/src/test/java/com/pengrad/telegrambot/TelegramBotTest.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import okhttp3.OkHttpClient;
99
import okhttp3.Request;
1010
import okhttp3.Response;
11+
import okhttp3.logging.HttpLoggingInterceptor;
1112
import org.junit.Test;
1213

1314
import java.io.File;
@@ -21,6 +22,7 @@
2122
import java.nio.file.Path;
2223
import java.nio.file.Paths;
2324
import java.util.*;
25+
import java.util.concurrent.TimeUnit;
2426

2527
import static com.pengrad.telegrambot.request.ContentTypes.VIDEO_MIME_TYPE;
2628
import static org.junit.Assert.*;
@@ -92,7 +94,12 @@ public TelegramBotTest() throws IOException {
9294
testPassportData = System.getenv("TEST_PASSPORT_DATA");
9395
}
9496

95-
bot = TelegramBotAdapter.buildDebug(token);
97+
bot = new TelegramBot.Builder(token)
98+
.okHttpClient(new OkHttpClient.Builder()
99+
.addInterceptor(new HttpLoggingInterceptor().setLevel(HttpLoggingInterceptor.Level.BODY))
100+
.readTimeout(60, TimeUnit.SECONDS) // setWebhook with certificate fails with timeout exception
101+
.build())
102+
.build();
96103
chatId = Integer.parseInt(chat);
97104
groupId = Long.parseLong(group);
98105
}

0 commit comments

Comments
 (0)