Skip to content
This repository was archived by the owner on May 28, 2018. It is now read-only.

Commit 8facec6

Browse files
committed
add another testcase as described by predatorvi in JERSEY-3214
1 parent 6125bc3 commit 8facec6

File tree

1 file changed

+19
-0
lines changed
  • connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector

1 file changed

+19
-0
lines changed

connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/ClosingTest.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,25 @@ public void testClosingConsumedResponse() throws Exception {
141141
assertEquals(1, getAvailableConnections());
142142
}
143143

144+
@Test
145+
public void testBufferedMultipleReadEntity() throws Exception {
146+
assertEquals(0, getOpenConnections());
147+
148+
Response response = target().path("productInfo")
149+
.request(MediaType.TEXT_PLAIN_TYPE)
150+
.get();
151+
152+
response.bufferEntity();
153+
assertEquals(0, getLeasedConnections());
154+
assertEquals(1, getAvailableConnections());
155+
156+
assertEquals("foo\n", new String(response.readEntity(byte[].class), "us-ascii"));
157+
assertEquals("foo\n", response.readEntity(String.class));
158+
159+
assertEquals(0, getLeasedConnections());
160+
assertEquals(1, getAvailableConnections());
161+
}
162+
144163
private static void consume(InputStream in) throws IOException {
145164
byte[] buffer = new byte[1024];
146165
for (int readden = in.read(buffer); readden >= 0; readden = in.read(buffer)) {

0 commit comments

Comments
 (0)