|
33 | 33 | import static com.google.common.truth.Truth.assertThat; |
34 | 34 | import static org.junit.Assert.assertThrows; |
35 | 35 |
|
36 | | -import com.google.api.client.http.javanet.NetHttpTransport; |
37 | 36 | import com.google.api.gax.core.NoCredentialsProvider; |
38 | 37 | import com.google.api.gax.retrying.RetrySettings; |
39 | 38 | import com.google.api.gax.rpc.StatusCode; |
@@ -328,7 +327,71 @@ void testTracing_retry_httpjson() throws Exception { |
328 | 327 | .setTransportChannelProvider( |
329 | 328 | EchoSettings.defaultHttpJsonTransportProviderBuilder() |
330 | 329 | .setHttpTransport( |
331 | | - new NetHttpTransport.Builder().doNotValidateCertificate().build()) |
| 330 | + new com.google.api.client.http.HttpTransport() { |
| 331 | + @Override |
| 332 | + protected com.google.api.client.http.LowLevelHttpRequest buildRequest( |
| 333 | + String method, String url) { |
| 334 | + return new com.google.api.client.http.LowLevelHttpRequest() { |
| 335 | + @Override |
| 336 | + public void addHeader(String name, String value) {} |
| 337 | + |
| 338 | + @Override |
| 339 | + public com.google.api.client.http.LowLevelHttpResponse execute() { |
| 340 | + return new com.google.api.client.http.LowLevelHttpResponse() { |
| 341 | + @Override |
| 342 | + public java.io.InputStream getContent() { |
| 343 | + return new java.io.ByteArrayInputStream("{}".getBytes()); |
| 344 | + } |
| 345 | + |
| 346 | + @Override |
| 347 | + public String getContentEncoding() { |
| 348 | + return null; |
| 349 | + } |
| 350 | + |
| 351 | + @Override |
| 352 | + public long getContentLength() { |
| 353 | + return 2; |
| 354 | + } |
| 355 | + |
| 356 | + @Override |
| 357 | + public String getContentType() { |
| 358 | + return "application/json"; |
| 359 | + } |
| 360 | + |
| 361 | + @Override |
| 362 | + public String getStatusLine() { |
| 363 | + return "HTTP/1.1 503 Service Unavailable"; |
| 364 | + } |
| 365 | + |
| 366 | + @Override |
| 367 | + public int getStatusCode() { |
| 368 | + return 503; |
| 369 | + } |
| 370 | + |
| 371 | + @Override |
| 372 | + public String getReasonPhrase() { |
| 373 | + return "Service Unavailable"; |
| 374 | + } |
| 375 | + |
| 376 | + @Override |
| 377 | + public int getHeaderCount() { |
| 378 | + return 0; |
| 379 | + } |
| 380 | + |
| 381 | + @Override |
| 382 | + public String getHeaderName(int index) { |
| 383 | + return null; |
| 384 | + } |
| 385 | + |
| 386 | + @Override |
| 387 | + public String getHeaderValue(int index) { |
| 388 | + return null; |
| 389 | + } |
| 390 | + }; |
| 391 | + } |
| 392 | + }; |
| 393 | + } |
| 394 | + }) |
332 | 395 | .setEndpoint("http://localhost:7469") |
333 | 396 | .build()) |
334 | 397 | .build(); |
|
0 commit comments