This repository was archived by the owner on May 28, 2018. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed
connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -141,6 +141,25 @@ public void testClosingConsumedResponse() throws Exception {
141
141
assertEquals (1 , getAvailableConnections ());
142
142
}
143
143
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
+
144
163
private static void consume (InputStream in ) throws IOException {
145
164
byte [] buffer = new byte [1024 ];
146
165
for (int readden = in .read (buffer ); readden >= 0 ; readden = in .read (buffer )) {
You can’t perform that action at this time.
0 commit comments