|
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; |
@@ -356,7 +355,71 @@ void testTracing_retry_httpjson() throws Exception { |
356 | 355 | .setTransportChannelProvider( |
357 | 356 | EchoSettings.defaultHttpJsonTransportProviderBuilder() |
358 | 357 | .setHttpTransport( |
359 | | - new NetHttpTransport.Builder().doNotValidateCertificate().build()) |
| 358 | + new com.google.api.client.http.HttpTransport() { |
| 359 | + @Override |
| 360 | + protected com.google.api.client.http.LowLevelHttpRequest buildRequest( |
| 361 | + String method, String url) { |
| 362 | + return new com.google.api.client.http.LowLevelHttpRequest() { |
| 363 | + @Override |
| 364 | + public void addHeader(String name, String value) {} |
| 365 | + |
| 366 | + @Override |
| 367 | + public com.google.api.client.http.LowLevelHttpResponse execute() { |
| 368 | + return new com.google.api.client.http.LowLevelHttpResponse() { |
| 369 | + @Override |
| 370 | + public java.io.InputStream getContent() { |
| 371 | + return new java.io.ByteArrayInputStream("{}".getBytes()); |
| 372 | + } |
| 373 | + |
| 374 | + @Override |
| 375 | + public String getContentEncoding() { |
| 376 | + return null; |
| 377 | + } |
| 378 | + |
| 379 | + @Override |
| 380 | + public long getContentLength() { |
| 381 | + return 2; |
| 382 | + } |
| 383 | + |
| 384 | + @Override |
| 385 | + public String getContentType() { |
| 386 | + return "application/json"; |
| 387 | + } |
| 388 | + |
| 389 | + @Override |
| 390 | + public String getStatusLine() { |
| 391 | + return "HTTP/1.1 503 Service Unavailable"; |
| 392 | + } |
| 393 | + |
| 394 | + @Override |
| 395 | + public int getStatusCode() { |
| 396 | + return 503; |
| 397 | + } |
| 398 | + |
| 399 | + @Override |
| 400 | + public String getReasonPhrase() { |
| 401 | + return "Service Unavailable"; |
| 402 | + } |
| 403 | + |
| 404 | + @Override |
| 405 | + public int getHeaderCount() { |
| 406 | + return 0; |
| 407 | + } |
| 408 | + |
| 409 | + @Override |
| 410 | + public String getHeaderName(int index) { |
| 411 | + return null; |
| 412 | + } |
| 413 | + |
| 414 | + @Override |
| 415 | + public String getHeaderValue(int index) { |
| 416 | + return null; |
| 417 | + } |
| 418 | + }; |
| 419 | + } |
| 420 | + }; |
| 421 | + } |
| 422 | + }) |
360 | 423 | .setEndpoint("http://localhost:7469") |
361 | 424 | .build()) |
362 | 425 | .build(); |
|
0 commit comments