Skip to content

Commit

Permalink
Use non-routable loop back address to avoid issues with firewalls
Browse files Browse the repository at this point in the history
  • Loading branch information
jack-berg committed Jan 3, 2024
1 parent 9a70faf commit fe14fdb
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@ void connectTimeout() {
TelemetryExporter<T> exporter =
exporterBuilder()
// Connecting to a non-routable IP address to trigger connection error
.setEndpoint("http://10.255.255.1")
.setEndpoint("http://127.255.255.255")
.setConnectTimeout(Duration.ofMillis(1))
.build();
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ void setup() throws IOException, InterruptedException {
sender =
new JdkHttpSender(
mockHttpClient,
"http://10.255.255.1", // Connecting to a non-routable IP address to trigger connection
"http://127.255.255.255", // Connecting to a non-routable IP address to trigger
// connection
// timeout
null,
false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,9 @@ void connectTimeout() throws Exception {
// Connecting to a non-routable IP address to trigger connection error
assertThatThrownBy(
() ->
client.newCall(new Request.Builder().url("http://10.255.255.1").build()).execute())
client
.newCall(new Request.Builder().url("http://127.255.255.255").build())
.execute())
.isInstanceOf(SocketTimeoutException.class);

verify(isRetryableException, times(5)).apply(any());
Expand All @@ -166,7 +168,9 @@ void nonRetryableException() throws InterruptedException {
// Connecting to a non-routable IP address to trigger connection timeout
assertThatThrownBy(
() ->
client.newCall(new Request.Builder().url("http://10.255.255.1").build()).execute())
client
.newCall(new Request.Builder().url("http://127.255.255.255").build())
.execute())
.isInstanceOf(SocketTimeoutException.class);

verify(isRetryableException, times(1)).apply(any());
Expand Down

0 comments on commit fe14fdb

Please sign in to comment.