Skip to content

Commit 7ba4045

Browse files
JonathanHensonrccarper
authored andcommitted
Fixed SPI test.
1 parent 6a72b11 commit 7ba4045

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

http-clients/aws-crt-client/src/main/java/software/amazon/awssdk/http/crt/internal/AwsCrtResponseBodyPublisher.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,8 +248,8 @@ protected synchronized void publishToSubscribers() {
248248
}
249249
}
250250

251-
// Check if Complete
252-
if (queueComplete.get() && queuedBuffers.size() == 0) {
251+
// Check if Complete, consider no subscriber as a completion.
252+
if (queueComplete.get() && (subscriberRef.get() == null || queuedBuffers.size() == 0)) {
253253
completeSubscriptionExactlyOnce();
254254
}
255255
}

http-clients/aws-crt-client/src/test/java/software/amazon/awssdk/http/crt/AwsCrtHttpClientSpiVerificationTest.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@
3737
import java.util.concurrent.TimeUnit;
3838
import java.util.concurrent.TimeoutException;
3939
import java.util.concurrent.atomic.AtomicReference;
40+
4041
import org.junit.After;
41-
import org.junit.Assert;
4242
import org.junit.Before;
4343
import org.junit.Rule;
4444
import org.junit.Test;
@@ -239,7 +239,6 @@ public void testPutRequest() throws Exception {
239239
stubFor(any(urlEqualTo(pathExpect200)).withRequestBody(binaryEqualTo(expectedBody)).willReturn(aResponse().withStatus(200)));
240240
makePutRequest(pathExpect200, expectedBody, 200);
241241

242-
243242
String pathExpect404 = "/testPutRequest/return_404_always";
244243
byte[] randomBody = generateRandomBody(TEST_BODY_LEN);
245244
stubFor(any(urlEqualTo(pathExpect404)).willReturn(aResponse().withStatus(404)));

0 commit comments

Comments
 (0)