Skip to content
This repository has been archived by the owner on Sep 26, 2023. It is now read-only.

Commit

Permalink
fix: fix httpjson executor (#1448)
Browse files Browse the repository at this point in the history
  • Loading branch information
mutianf committed Aug 9, 2021
1 parent 209b494 commit 8f48b70
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ public static class Builder {
private Builder() {}

public Builder setExecutor(Executor executor) {
this.executor = Preconditions.checkNotNull(executor);
this.executor = executor == null ? DEFAULT_EXECUTOR : executor;
return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,13 @@ public void basicTest() throws IOException {
provider = provider.withEndpoint(endpoint);
assertThat(provider.needsEndpoint()).isFalse();

assertThat(provider.needsHeaders()).isTrue();
provider = provider.withHeaders(Collections.<String, String>emptyMap());
assertThat(provider.needsHeaders()).isFalse();

// Make sure getTransportChannel works without setting executor
assertThat(provider.getTransportChannel()).isInstanceOf(HttpJsonTransportChannel.class);

assertThat(provider.needsExecutor()).isTrue();
provider = provider.withExecutor((Executor) executor);
assertThat(provider.needsExecutor()).isFalse();
Expand All @@ -71,10 +78,6 @@ public void basicTest() throws IOException {
provider = provider.withExecutor(executor);
assertThat(provider.needsExecutor()).isFalse();

assertThat(provider.needsHeaders()).isTrue();
provider = provider.withHeaders(Collections.<String, String>emptyMap());
assertThat(provider.needsHeaders()).isFalse();

assertThat(provider.acceptsPoolSize()).isFalse();
Exception thrownException = null;
try {
Expand Down

0 comments on commit 8f48b70

Please sign in to comment.