1
0
mirror of https://github.com/square/okhttp.git synced 2025-11-27 18:21:14 +03:00

Add Framed protocol to connections

This commit is contained in:
gkimbwala
2016-01-15 17:58:03 -08:00
parent 9b0706489c
commit c3f8dcb22e
4 changed files with 65 additions and 43 deletions

View File

@@ -113,12 +113,12 @@ public final class HttpLoggingInterceptorTest {
client.newCall(request().build()).execute();
applicationLogs
.assertLogEqual("--> GET " + url + " HTTP/1.1")
.assertLogEqual("--> GET " + url + " http/1.1")
.assertLogMatch("<-- 200 OK " + url + " \\(\\d+ms, 0-byte body\\)")
.assertNoMoreLogs();
networkLogs
.assertLogEqual("--> GET " + url + " HTTP/1.1")
.assertLogEqual("--> GET " + url + " http/1.1")
.assertLogMatch("<-- 200 OK " + url + " \\(\\d+ms, 0-byte body\\)")
.assertNoMoreLogs();
}
@@ -130,12 +130,12 @@ public final class HttpLoggingInterceptorTest {
client.newCall(request().post(RequestBody.create(PLAIN, "Hi?")).build()).execute();
applicationLogs
.assertLogEqual("--> POST " + url + " HTTP/1.1 (3-byte body)")
.assertLogEqual("--> POST " + url + " http/1.1 (3-byte body)")
.assertLogMatch("<-- 200 OK " + url + " \\(\\d+ms, 0-byte body\\)")
.assertNoMoreLogs();
networkLogs
.assertLogEqual("--> POST " + url + " HTTP/1.1 (3-byte body)")
.assertLogEqual("--> POST " + url + " http/1.1 (3-byte body)")
.assertLogMatch("<-- 200 OK " + url + " \\(\\d+ms, 0-byte body\\)")
.assertNoMoreLogs();
}
@@ -150,12 +150,12 @@ public final class HttpLoggingInterceptorTest {
response.body().close();
applicationLogs
.assertLogEqual("--> GET " + url + " HTTP/1.1")
.assertLogEqual("--> GET " + url + " http/1.1")
.assertLogMatch("<-- 200 OK " + url + " \\(\\d+ms, 6-byte body\\)")
.assertNoMoreLogs();
networkLogs
.assertLogEqual("--> GET " + url + " HTTP/1.1")
.assertLogEqual("--> GET " + url + " http/1.1")
.assertLogMatch("<-- 200 OK " + url + " \\(\\d+ms, 6-byte body\\)")
.assertNoMoreLogs();
}
@@ -170,12 +170,12 @@ public final class HttpLoggingInterceptorTest {
response.body().close();
applicationLogs
.assertLogEqual("--> GET " + url + " HTTP/1.1")
.assertLogEqual("--> GET " + url + " http/1.1")
.assertLogMatch("<-- 200 OK " + url + " \\(\\d+ms, unknown-length body\\)")
.assertNoMoreLogs();
networkLogs
.assertLogEqual("--> GET " + url + " HTTP/1.1")
.assertLogEqual("--> GET " + url + " http/1.1")
.assertLogMatch("<-- 200 OK " + url + " \\(\\d+ms, unknown-length body\\)")
.assertNoMoreLogs();
}
@@ -188,7 +188,7 @@ public final class HttpLoggingInterceptorTest {
response.body().close();
applicationLogs
.assertLogEqual("--> GET " + url + " HTTP/1.1")
.assertLogEqual("--> GET " + url + " http/1.1")
.assertLogEqual("--> END GET")
.assertLogMatch("<-- 200 OK " + url + " \\(\\d+ms\\)")
.assertLogEqual("Content-Length: 0")
@@ -198,7 +198,7 @@ public final class HttpLoggingInterceptorTest {
.assertNoMoreLogs();
networkLogs
.assertLogEqual("--> GET " + url + " HTTP/1.1")
.assertLogEqual("--> GET " + url + " http/1.1")
.assertLogEqual("Host: " + host)
.assertLogEqual("Connection: Keep-Alive")
.assertLogEqual("Accept-Encoding: gzip")
@@ -221,7 +221,7 @@ public final class HttpLoggingInterceptorTest {
response.body().close();
applicationLogs
.assertLogEqual("--> POST " + url + " HTTP/1.1")
.assertLogEqual("--> POST " + url + " http/1.1")
.assertLogEqual("Content-Type: text/plain; charset=utf-8")
.assertLogEqual("Content-Length: 3")
.assertLogEqual("--> END POST")
@@ -233,7 +233,7 @@ public final class HttpLoggingInterceptorTest {
.assertNoMoreLogs();
networkLogs
.assertLogEqual("--> POST " + url + " HTTP/1.1")
.assertLogEqual("--> POST " + url + " http/1.1")
.assertLogEqual("Content-Type: text/plain; charset=utf-8")
.assertLogEqual("Content-Length: 3")
.assertLogEqual("Host: " + host)
@@ -258,7 +258,7 @@ public final class HttpLoggingInterceptorTest {
response.body().close();
applicationLogs
.assertLogEqual("--> POST " + url + " HTTP/1.1")
.assertLogEqual("--> POST " + url + " http/1.1")
.assertLogEqual("Content-Length: 3")
.assertLogEqual("--> END POST")
.assertLogMatch("<-- 200 OK " + url + " \\(\\d+ms\\)")
@@ -269,7 +269,7 @@ public final class HttpLoggingInterceptorTest {
.assertNoMoreLogs();
networkLogs
.assertLogEqual("--> POST " + url + " HTTP/1.1")
.assertLogEqual("--> POST " + url + " http/1.1")
.assertLogEqual("Content-Length: 3")
.assertLogEqual("Host: " + host)
.assertLogEqual("Connection: Keep-Alive")
@@ -301,7 +301,7 @@ public final class HttpLoggingInterceptorTest {
response.body().close();
applicationLogs
.assertLogEqual("--> POST " + url + " HTTP/1.1")
.assertLogEqual("--> POST " + url + " http/1.1")
.assertLogEqual("Content-Type: text/plain; charset=utf-8")
.assertLogEqual("--> END POST")
.assertLogMatch("<-- 200 OK " + url + " \\(\\d+ms\\)")
@@ -312,7 +312,7 @@ public final class HttpLoggingInterceptorTest {
.assertNoMoreLogs();
networkLogs
.assertLogEqual("--> POST " + url + " HTTP/1.1")
.assertLogEqual("--> POST " + url + " http/1.1")
.assertLogEqual("Content-Type: text/plain; charset=utf-8")
.assertLogEqual("Transfer-Encoding: chunked")
.assertLogEqual("Host: " + host)
@@ -338,7 +338,7 @@ public final class HttpLoggingInterceptorTest {
response.body().close();
applicationLogs
.assertLogEqual("--> GET " + url + " HTTP/1.1")
.assertLogEqual("--> GET " + url + " http/1.1")
.assertLogEqual("--> END GET")
.assertLogMatch("<-- 200 OK " + url + " \\(\\d+ms\\)")
.assertLogEqual("Content-Length: 6")
@@ -349,7 +349,7 @@ public final class HttpLoggingInterceptorTest {
.assertNoMoreLogs();
networkLogs
.assertLogEqual("--> GET " + url + " HTTP/1.1")
.assertLogEqual("--> GET " + url + " http/1.1")
.assertLogEqual("Host: " + host)
.assertLogEqual("Connection: Keep-Alive")
.assertLogEqual("Accept-Encoding: gzip")
@@ -372,7 +372,7 @@ public final class HttpLoggingInterceptorTest {
response.body().close();
applicationLogs
.assertLogEqual("--> GET " + url + " HTTP/1.1")
.assertLogEqual("--> GET " + url + " http/1.1")
.assertLogEqual("--> END GET")
.assertLogMatch("<-- 200 OK " + url + " \\(\\d+ms\\)")
.assertLogEqual("Content-Length: 0")
@@ -382,7 +382,7 @@ public final class HttpLoggingInterceptorTest {
.assertNoMoreLogs();
networkLogs
.assertLogEqual("--> GET " + url + " HTTP/1.1")
.assertLogEqual("--> GET " + url + " http/1.1")
.assertLogEqual("Host: " + host)
.assertLogEqual("Connection: Keep-Alive")
.assertLogEqual("Accept-Encoding: gzip")
@@ -413,7 +413,7 @@ public final class HttpLoggingInterceptorTest {
response.body().close();
applicationLogs
.assertLogEqual("--> GET " + url + " HTTP/1.1")
.assertLogEqual("--> GET " + url + " http/1.1")
.assertLogEqual("--> END GET")
.assertLogMatch("<-- " + code + " No Content " + url + " \\(\\d+ms\\)")
.assertLogEqual("Content-Length: 0")
@@ -423,7 +423,7 @@ public final class HttpLoggingInterceptorTest {
.assertNoMoreLogs();
networkLogs
.assertLogEqual("--> GET " + url + " HTTP/1.1")
.assertLogEqual("--> GET " + url + " http/1.1")
.assertLogEqual("Host: " + host)
.assertLogEqual("Connection: Keep-Alive")
.assertLogEqual("Accept-Encoding: gzip")
@@ -446,7 +446,7 @@ public final class HttpLoggingInterceptorTest {
response.body().close();
applicationLogs
.assertLogEqual("--> POST " + url + " HTTP/1.1")
.assertLogEqual("--> POST " + url + " http/1.1")
.assertLogEqual("Content-Type: text/plain; charset=utf-8")
.assertLogEqual("Content-Length: 3")
.assertLogEqual("")
@@ -460,7 +460,7 @@ public final class HttpLoggingInterceptorTest {
.assertNoMoreLogs();
networkLogs
.assertLogEqual("--> POST " + url + " HTTP/1.1")
.assertLogEqual("--> POST " + url + " http/1.1")
.assertLogEqual("Content-Type: text/plain; charset=utf-8")
.assertLogEqual("Content-Length: 3")
.assertLogEqual("Host: " + host)
@@ -488,7 +488,7 @@ public final class HttpLoggingInterceptorTest {
response.body().close();
applicationLogs
.assertLogEqual("--> GET " + url + " HTTP/1.1")
.assertLogEqual("--> GET " + url + " http/1.1")
.assertLogEqual("--> END GET")
.assertLogMatch("<-- 200 OK " + url + " \\(\\d+ms\\)")
.assertLogEqual("Content-Length: 6")
@@ -501,7 +501,7 @@ public final class HttpLoggingInterceptorTest {
.assertNoMoreLogs();
networkLogs
.assertLogEqual("--> GET " + url + " HTTP/1.1")
.assertLogEqual("--> GET " + url + " http/1.1")
.assertLogEqual("Host: " + host)
.assertLogEqual("Connection: Keep-Alive")
.assertLogEqual("Accept-Encoding: gzip")
@@ -528,7 +528,7 @@ public final class HttpLoggingInterceptorTest {
response.body().close();
applicationLogs
.assertLogEqual("--> GET " + url + " HTTP/1.1")
.assertLogEqual("--> GET " + url + " http/1.1")
.assertLogEqual("--> END GET")
.assertLogMatch("<-- 200 OK " + url + " \\(\\d+ms\\)")
.assertLogEqual("Transfer-encoding: chunked")
@@ -541,7 +541,7 @@ public final class HttpLoggingInterceptorTest {
.assertNoMoreLogs();
networkLogs
.assertLogEqual("--> GET " + url + " HTTP/1.1")
.assertLogEqual("--> GET " + url + " http/1.1")
.assertLogEqual("Host: " + host)
.assertLogEqual("Connection: Keep-Alive")
.assertLogEqual("Accept-Encoding: gzip")
@@ -570,7 +570,7 @@ public final class HttpLoggingInterceptorTest {
response.body().close();
networkLogs
.assertLogEqual("--> GET " + url + " HTTP/1.1")
.assertLogEqual("--> GET " + url + " http/1.1")
.assertLogEqual("Host: " + host)
.assertLogEqual("Connection: Keep-Alive")
.assertLogEqual("Accept-Encoding: gzip")
@@ -586,7 +586,7 @@ public final class HttpLoggingInterceptorTest {
.assertNoMoreLogs();
applicationLogs
.assertLogEqual("--> GET " + url + " HTTP/1.1")
.assertLogEqual("--> GET " + url + " http/1.1")
.assertLogEqual("--> END GET")
.assertLogMatch("<-- 200 OK " + url + " \\(\\d+ms\\)")
.assertLogEqual("Content-Type: text/plain; charset=utf-8")