File tree Expand file tree Collapse file tree 2 files changed +8
-13
lines changed
main/java/com/pengrad/telegrambot
test/java/com/pengrad/telegrambot Expand file tree Collapse file tree 2 files changed +8
-13
lines changed Original file line number Diff line number Diff line change 88import com .pengrad .telegrambot .request .BaseRequest ;
99import com .pengrad .telegrambot .request .GetUpdates ;
1010import com .pengrad .telegrambot .response .BaseResponse ;
11+ import okhttp3 .Interceptor ;
12+ import okhttp3 .OkHttpClient ;
13+ import okhttp3 .logging .HttpLoggingInterceptor ;
1114
1215import java .io .InputStream ;
1316import java .net .URL ;
1417import java .net .URLConnection ;
15-
16- import okhttp3 .Interceptor ;
17- import okhttp3 .OkHttpClient ;
18- import okhttp3 .logging .HttpLoggingInterceptor ;
18+ import java .util .concurrent .TimeUnit ;
1919
2020/**
2121 * Stas Parshin
@@ -128,7 +128,9 @@ public TelegramBot build() {
128128 }
129129
130130 private static OkHttpClient client (Interceptor interceptor ) {
131- OkHttpClient .Builder builder = new OkHttpClient .Builder ();
131+ OkHttpClient .Builder builder = new OkHttpClient .Builder ()
132+ .connectTimeout (75 , TimeUnit .SECONDS )
133+ .readTimeout (75 , TimeUnit .SECONDS );
132134 if (interceptor != null ) builder .addInterceptor (interceptor );
133135 return builder .build ();
134136 }
Original file line number Diff line number Diff line change 88import okhttp3 .OkHttpClient ;
99import okhttp3 .Request ;
1010import okhttp3 .Response ;
11- import okhttp3 .logging .HttpLoggingInterceptor ;
1211import org .junit .Test ;
1312
1413import java .io .File ;
2221import java .nio .file .Path ;
2322import java .nio .file .Paths ;
2423import java .util .*;
25- import java .util .concurrent .TimeUnit ;
2624
2725import static com .pengrad .telegrambot .request .ContentTypes .VIDEO_MIME_TYPE ;
2826import static org .junit .Assert .*;
@@ -94,12 +92,7 @@ public TelegramBotTest() throws IOException {
9492 testPassportData = System .getenv ("TEST_PASSPORT_DATA" );
9593 }
9694
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 ();
95+ bot = new TelegramBot .Builder (token ).debug ().build ();
10396 chatId = Integer .parseInt (chat );
10497 groupId = Long .parseLong (group );
10598 }
You can’t perform that action at this time.
0 commit comments