Lines Matching defs:connection

83   protected HttpURLConnection connection;
106 connection = client.open(server.getUrl("/foo"));
107 assertContent("ABCDE", connection, Integer.MAX_VALUE);
108 assertEquals(200, connection.getResponseCode());
109 assertEquals("Sweet", connection.getResponseMessage());
121 connection = client.open(server.getUrl("/foo"));
122 assertEquals(-1, connection.getInputStream().read());
133 connection = client.open(server.getUrl("/foo"));
134 connection.setDoOutput(true);
135 connection.getOutputStream().write(postBytes);
136 assertContent("ABCDE", connection, Integer.MAX_VALUE);
149 connection = client.open(server.getUrl("/foo"));
150 connection.setRequestProperty("Content-Length", String.valueOf(postBytes.length));
151 connection.setDoOutput(true);
152 connection.getOutputStream().write(postBytes);
153 assertContent("ABCDE", connection, Integer.MAX_VALUE);
166 connection = client.open(server.getUrl("/foo"));
167 connection.setRequestProperty("Content-Length", String.valueOf(postBytes.length));
168 connection.setDoOutput(true);
169 connection.getOutputStream().write(postBytes); // push bytes into SpdyDataOutputStream.buffer
170 connection.getOutputStream().flush(); // SpdyConnection.writeData subject to write window
171 connection.getOutputStream().close(); // SpdyConnection.writeData empty frame
172 assertContent("ABCDE", connection, Integer.MAX_VALUE);
185 connection = client.open(server.getUrl("/foo"));
186 connection.setFixedLengthStreamingMode(postBytes.length);
187 connection.setDoOutput(true);
188 connection.getOutputStream().write(postBytes);
189 assertContent("ABCDE", connection, Integer.MAX_VALUE);
241 connection = client.open(server.getUrl("/"));
242 assertEquals("Successful auth!", readAscii(connection.getInputStream(), Integer.MAX_VALUE));
259 connection = client.open(server.getUrl("/"));
260 assertContent("This is the new location!", connection, Integer.MAX_VALUE);
272 connection = client.open(server.getUrl("/"));
273 InputStream in = connection.getInputStream();
285 connection = client.open(server.getUrl("/"));
286 connection.setReadTimeout(1000);
287 assertContent("A", connection, Integer.MAX_VALUE);
302 .throttleBody(1024, 1, SECONDS)); // slow connection 1KiB/second
305 connection = client.open(server.getUrl("/"));
306 connection.setReadTimeout(2000); // 2 seconds to read something.
307 assertContent(new String(body), connection, Integer.MAX_VALUE);
322 .throttleBody(1024, 1, SECONDS)); // slow connection 1KiB/second
325 connection = client.open(server.getUrl("/"));
326 connection.setReadTimeout(500); // half a second to read something
327 connection.connect();
329 readAscii(connection.getInputStream(), Integer.MAX_VALUE);
429 void assertContent(String expected, HttpURLConnection connection, int limit)
431 connection.connect();
432 assertEquals(expected, readAscii(connection.getInputStream(), limit));