Death, Taxes, and HTTP

A presentation at Chicago Roboto in April 2017 in Chicago, IL, USA by Jake Wharton

Slide 1

Slide 1

Death, Taxes, and HTTP @JesseWilson @JakeWha ! on

Slide 2

Slide 2

You

Slide 3

Slide 3

Your Team

Slide 4

Slide 4

Client

Slide 5

Slide 5

Client

Slide 6

Slide 6

Client Server

Slide 7

Slide 7

Client Server

Slide 8

Slide 8

Server

Client

Slide 9

Slide 9

Client

Server

Slide 10

Slide 10

Client

Server

Slide 11

Slide 11

Round-Trip Time Client Server

Slide 12

Slide 12

RTT Client Server

Slide 13

Slide 13

Client Server

Slide 14

Slide 14

Client Server GET / HTTP/1.1

Slide 15

Slide 15

Client Server GET / HTTP/1.1 HTTP/1.1 200 OK

Slide 16

Slide 16

Client Server GET / HTTP/1.1 HTTP/1.1 200 OK

Slide 17

Slide 17

Client Server GET / HTTP/1.1 HTTP/1.1 200 OK Transpo ! Layer Security

Slide 18

Slide 18

Client Server GET / HTTP/1.1 HTTP/1.1 200 OK TLS

Slide 19

Slide 19

Client Server GET / HTTP/1.1 HTTP/1.1 200 OK TLS

Slide 20

Slide 20

Client Server TLS v1.2

Slide 21

Slide 21

Client Server TLS v1.2 U TLS ?

Slide 22

Slide 22

Client Server TLS v1.2 Ya. Here's my ce ! .

Slide 23

Slide 23

Client Server TLS v1.2 Great. Key is hunter2

Slide 24

Slide 24

Client Server TLS v1.2 I'm ready!

Slide 25

Slide 25

Client Server TLS v1.2 GET / HTTP/1.1

Slide 26

Slide 26

Client Server TLS v1.2 GET / HTTP/1.1 HTTP/1.1 200 OK

Slide 27

Slide 27

Client Server TLS v1.2 w/ session resumption GET / HTTP/1.1 HTTP/1.1 200 OK

Slide 28

Slide 28

GET / HTTP/1.1 HTTP/1.1 200 OK Client Server TLS v1.2 w/ session resumption

Slide 29

Slide 29

Client Server TLS v1.2 w/ session resumption GET / HTTP/1.1 HTTP/1.1 200 OK

3

Slide 30

Slide 30

Client Server TLS v1.3

Slide 31

Slide 31

Client Server TLS v1.3 TLS? Key is hunter2

Slide 32

Slide 32

Client Server TLS v1.3 Ya. Here's my ce ! and key

Slide 33

Slide 33

Client Server TLS v1.3 Let's go!

Slide 34

Slide 34

Client Server TLS v1.3 GET / HTTP/1.1

Slide 35

Slide 35

Client Server TLS v1.3 GET / HTTP/1.1 HTTP/1.1 200 OK

Slide 36

Slide 36

Client Server TLS v1.3 w/ session resumption GET / HTTP/1.1 HTTP/1.1 200 OK

Slide 37

Slide 37

Client Server TLS v1.3 w/ 0-RTT session resumption

Slide 38

Slide 38

Client Server TLS v1.3 w/ 0-RTT session resumption

Slide 39

Slide 39

Client Server TLS v1.3 w/ 0-RTT session resumption GET / HTTP/1.1

Slide 40

Slide 40

Client Server TLS v1.3 w/ 0-RTT session resumption GET / HTTP/1.1

Slide 41

Slide 41

Client Server TLS v1.3 w/ 0-RTT session resumption GET / HTTP/1.1 HTTP/1.1 200 OK

Slide 42

Slide 42

Client Server TLS v1.3 w/ 0-RTT session resumption GET / HTTP/1.1 HTTP/1.1 200 OK

Slide 43

Slide 43

Client Server TLS v1.3 w/ 0-RTT session resumption GET / HTTP/1.1 HTTP/1.1 200 OK

Slide 44

Slide 44

RTT TLS v1.3 w/ 0-RTT session resumption TLS v1.3 w/ session resumption TLS v1.3 TLS v1.2 w/ session resumption TLS v1.2 2 1 1 1 0

Slide 45

Slide 45

OkHttpClient client = new OkHttpClient() ;

Request request = new Request.Builder() .url( "https://twitter.com" ) .build() ; Call call = client.newCall(request) ; Response response = call.execute() ; System. out .println(response.handshake().tlsVersion()) ;

Slide 46

Slide 46

OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder() .url("https://twitter.com ") .build(); Call call = client.newCall(request); Response response = call.execute(); System. out .println( response.handshake().tlsVersion() );

Slide 47

Slide 47

OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder() .url("https://twitter.com ") .build(); Call call = client.newCall(request); Response response = call.execute(); System. out .println( response.handshake().tlsVersion() ); TLS_1_2

Slide 48

Slide 48

HTTP Client Server GET / HTTP/1.1 HTTP/1.1 200 OK

Slide 49

Slide 49

HTTP Client Server GET / HTTP/1.1 HTTP/1.1 200 OK

Slide 50

Slide 50

HTTP Client GET / HTTP/1.1 HTTP/1.1 200 OK Server

Slide 51

Slide 51

HTTP Server GET / HTTP/1.1 HTTP/1.1 200 OK Client

Slide 52

Slide 52

HTTP Server Client GET / Y HTTP/1.1 HTTP/1.1 200 OK

Slide 53

Slide 53

GET / Y HTTP/1.1 Host: square.com:443 User-Agent: okhttp/3.7.0 Accept: application/json Authorization: Basic QWxhZGRpbjpPcGVuU2VzYW1l HTTP/1.1 200 OK Content-Type: application/json Content-Length: 42 E-Tag: "686897696a7c876b7e" Last-Modified: Thu, 20 Apr 2017 12:45:26 GMT

{"id":1234,"amount":4200,"currency":"USD"} HTTP

Slide 54

Slide 54

/ Y /payments.html /profile.html /login.html /settings.html /static/fonts/roboto.ttf /static/js/app.js /static/css/main.css /static/image/logo.png

Slide 55

Slide 55

/ Y /payments.html /profile.html /login.html /settings.html /static/fonts/roboto.ttf /static/js/app.js /static/css/main.css /static/image/logo.png /api/auth /api/user /api/payments /api/payments/1234 /api/settings

Slide 56

Slide 56

Server Client GET /api/payments HTTP/1.1 200 OK

Slide 57

Slide 57

Server Client GET /api/payments HTTP/1.1 200 OK

Slide 58

Slide 58

Server Client GET /api/payments HTTP/1.1 200 OK

Slide 59

Slide 59

Server Client GET /api/payments HTTP/1.1 200 OK

Slide 60

Slide 60

Server Client GET /api/payments HTTP/1.1 200 OK

Slide 61

Slide 61

Server Client GET /api/payments HTTP/1.1 200 OK

Slide 62

Slide 62

Server Client GET /api/payments HTTP/1.1 200 OK

Slide 63

Slide 63

.html

Slide 64

Slide 64

.js .html .js .js .js .js .js .js

Slide 65

Slide 65

.js .html .js .js .js .js .js .js .css .css .css .css

Slide 66

Slide 66

.js .html .js .js .js .js .js .js .png .png .png .png .png .png .png .png .css .css .css .css

Slide 67

Slide 67

.js .html .js .js .js .js .js .js .png .jpg .png .png .jpg .png .png .png .png .png .css .css .css .css

Slide 68

Slide 68

.js .html .js .js .js .js .js .js .png .jpg .png .png .jpg .png .png .png .png .png .css .css .css .css 22 requests

Slide 69

Slide 69

.js .html .png .jpg .png .png .jpg .png .png .png .png .png .css .css .css .css 16 requests .js .js .js .js .js .js

Slide 70

Slide 70

.js .html .png .jpg .png .png .jpg .png .png .png .png .png .css 13 requests .css .css .css

Slide 71

Slide 71

.js .html .jpg .jpg .png .css 6 requests .png .png .png .png .png .png .png

Slide 72

Slide 72

Slide 73

Slide 73

.js .html .jpg .jpg .png .css 6 requests .png .png .png .png .png .png .png

Slide 74

Slide 74

.js .html .jpg .jpg .png .css 1+3+2 requests example.com cdn.example.com images.example.com

Slide 75

Slide 75

.html .js .jpg .jpg .png .css example.com cdn.example.com images.example.com

Slide 76

Slide 76

.js .png .css .html .jpg .jpg example.com cdn.example.com images.example.com

Slide 77

Slide 77

.jpg .jpg .jpg .jpg .jpg .jpg .jpg .jpg .js .html .png .css example.com cdn.example.com images.example.com

Slide 78

Slide 78

.jpg .jpg .jpg .jpg .jpg .jpg .jpg .jpg .js .html .png .css example.com cdn.example.com images.example.com

Slide 79

Slide 79

images1.example.com .jpg .jpg .jpg .jpg .jpg .jpg .jpg .jpg images2.example.com .js .html .png .css example.com cdn.example.com

Slide 80

Slide 80

.js .html .png .css example.com cdn.example.com images1.example.com .jpg .jpg .jpg .jpg .jpg .jpg .jpg .jpg images2.example.com

Slide 81

Slide 81

Server Client GET /api/payments HTTP/1.1 200 OK

Slide 82

Slide 82

/api/payments [ A

1234, 1275, 1690, 2641, 2903, 4991, 5312, 5319, 14328, 28321, 29948, 30991, 37174, 73572 ] B

Slide 83

Slide 83

/api/payments [ A

1234, 1275, 1690, 2641, 2903, 4991, 5312, 5319, 14328, 28321, 29948, 30991, 37174, 73572 ] B /api/payments/{id} { C

id: 1234, amount: 4200, currency: "USD", initiator_id: F 48818374, recipient_id: G 24567654 , initiated_at: 14764993868, completed_at: 14769455213 } ,Z

Slide 84

Slide 84

/api/payments [ A

{ C

id: 1234, 
amount: 4200, 
currency: "USD", 
initiator:

F { id: 48818374, name: "Jake Wharton" }, recipient: G { id: 24567654 , name: "Jesse Wilson" }, initiated_at: 14764993868, completed_at: 14769455213 }, Z

... 1234 /api/payments/{id} 1275 1690, 2641, 2903, 4991, 5312, 5319, 14328, 28321, 29948, 30991, 37174, 73572

Slide 85

Slide 85

HTTP/2 Client Server GET /api/payments HTTP/1.1 200 OK

Slide 86

Slide 86

HTTP/2 Client Server GET /api/payments HTTP/1.1 200 OK

Slide 87

Slide 87

HTTP/2 Client Server GET /api/payments HTTP/1.1 200 OK

Slide 88

Slide 88

HTTP/2 Client Server GET /api/payments HTTP/1.1 200 OK

Slide 89

Slide 89

HTTP/2 Client Server GET /api/payments HTTP/1.1 200 OK

Slide 90

Slide 90

HTTP/2 Client Server GET /api/payments HTTP/1.1 200 OK

Slide 91

Slide 91

HTTP/2 Client Server GET /api/payments HTTP/1.1 200 OK

Slide 92

Slide 92

HTTP/2 Client Server GET /api/payments HTTP/1.1 200 OK

Slide 93

Slide 93

HTTP/2 Client Server GET /api/payments HTTP/1.1 200 OK

Slide 94

Slide 94

HTTP/2 Client Server GET /api/payments HTTP/1.1 200 OK

Slide 95

Slide 95

HTTP/2 Client Server GET /api/payments HTTP/1.1 200 OK

Slide 96

Slide 96

HTTP/2 Client Server GET /api/payments ?last=43163 HTTP/1.1 200 OK

Slide 97

Slide 97

HTTP/2 Client Server GET /api/payments ?last=43163 HTTP/1.1 200 OK

Slide 98

Slide 98

HTTP/2 Client Server GET /api/payments ?last=43163 HTTP/1.1 200 OK

Slide 99

Slide 99

HTTP/2 Client Server GET /api/payments ?last=43163 HTTP/1.1 200 OK

Slide 100

Slide 100

HTTP/2 Client Server GET /api/payments ?last=43163 HTTP/1.1 200 OK

Slide 101

Slide 101

HTTP/1.1 GET /api/payments ?last=43163 HTTP/1.1 200 OK GET /api/payments HTTP/1.1 200 OK HTTP/2

Slide 102

Slide 102

HTTP/1.1 GET /api/payments ?last=43163 HTTP/1.1 200 OK GET /api/payments HTTP/1.1 200 OK HTTP/2 time

Slide 103

Slide 103

GET /

HTTP/1.1 Host: square.com:443 User-Agent: okhttp/3.7.0 Accept: application/json Authorization: Basic QWxhZGRpbjpPcGVuU2VzYW1l HTTP/1.1 200 OK Content-Type: application/json Content-Length: 42 E-Tag: "686897696a7c876b7e" Last-Modified: Thu, 20 Apr 2017 12:45:26 GMT

{"id":1234,"amount":4200,"currency":"USD"} HTTP/1.1 HTTP/2 GET /

HTTP/1.1 Host: square.com:443 User-Agent: okhttp/3.7.0 Accept: application/json Authorization: Basic QWxhZGRpbjpPcGVuU2VzYW1l HTTP/1.1 200 OK Content-Type: application/json Content-Length: 42 E-Tag: "686897696a7c876b7e" Last-Modified: Thu, 20 Apr 2017 12:45:26 GMT

{"id":1234,"amount":4200,"currency":"USD"}

Slide 104

Slide 104

GET /

HTTP/1.1 Host: square.com:443 User-Agent: okhttp/3.7.0 Accept: application/json Authorization: Basic QWxhZGRpbjpPcGVuU2VzYW1l HTTP/1.1 200 OK Content-Type: application/json Content-Length: 42 E-Tag: "686897696a7c876b7e" Last-Modified: Thu, 20 Apr 2017 12:45:26 GMT

{"id":1234,"amount":4200,"currency":"USD"} HTTP/1.1 HTTP/2 GET /

HTTP/1.1 Host: square.com:443 User-Agent: okhttp/3.7.0 Accept: application/json Authorization: Basic QWxhZGRpbjpPcGVuU2VzYW1l HTTP/1.1 200 OK Content-Type: application/json Content-Length: 42 E-Tag: "686897696a7c876b7e" Last-Modified: Thu, 20 Apr 2017 12:45:26 GMT

{"id":1234,"amount":4200,"currency":"USD"}

Slide 105

Slide 105

GET /

HTTP/1.1 Host: square.com:443 User-Agent: okhttp/3.7.0 Accept: application/json Authorization: Basic QWxhZGRpbjpPcGVuU2VzYW1l Client Server HTTP/1.1 200 OK Content-Type: application/json Content-Length: 42 E-Tag: "686897696a7c876b7e" Last-Modified: Thu, 20 Apr 2017 12:45:26 GMT

{"id":1234,"amount":4200,"currency":"USD"}

Slide 106

Slide 106

GET /

HTTP/1.1 Host: square.com:443 User-Agent: okhttp/3.7.0 Accept: application/json Authorization: Basic QWxhZGRpbjpPcGVuU2VzYW1l Client Server HTTP/1.1 200 OK Content-Type: application/json Content-Length: 42 E-Tag: "686897696a7c876b7e" Last-Modified: Thu, 20 Apr 2017 12:45:26 GMT

{"id":1234,"amount":4200,"currency":"USD"}

Slide 107

Slide 107

GET /

HTTP/1.1 Host: square.com:443 User-Agent: okhttp/3.7.0 Accept: application/json Authorization: Basic QWxhZGRpbjpPcGVuU2VzYW1l Client Server HTTP/1.1 200 OK Content-Type: application/json Content-Length: 42 E-Tag: "686897696a7c876b7e" Last-Modified: Thu, 20 Apr 2017 12:45:26 GMT

{"id":1234,"amount":4200,"currency":"USD"} ID: 2 ID: 2

Slide 108

Slide 108

GET /

HTTP/1.1 Host: square.com:443 User-Agent: okhttp/3.7.0 Accept: application/json Authorization: Basic QWxhZGRpbjpPcGVuU2VzYW1l Client Server HTTP/1.1 200 OK Content-Type: application/json Content-Length: 42 E-Tag: "686897696a7c876b7e" Last-Modified: Thu, 20 Apr 2017 12:45:26 GMT

{"id":1234,"amount":4200,"currency":"USD"} ID: 2 ID: 2 GET /api/payments

HTTP/1.1 Host: square.com:443 User-Agent: okhttp/3.7.0 Accept: application/json Authorization: Basic QWxhZGRpbjpPcGVuU2VzYW1l ID: 4

Slide 109

Slide 109

GET /

HTTP/1.1 Host: square.com:443 User-Agent: okhttp/3.7.0 Accept: application/json Authorization: Basic QWxhZGRpbjpPcGVuU2VzYW1l Client Server HTTP/1.1 200 OK Content-Type: application/json Content-Length: 42 E-Tag: "686897696a7c876b7e" Last-Modified: Thu, 20 Apr 2017 12:45:26 GMT

{"id":1234,"amount":4200,"currency":"USD"} ID: 2 ID: 2 GET /api/payments

HTTP/1.1 Host: square.com:443 User-Agent: okhttp/3.7.0 Accept: application/json Authorization: Basic QWxhZGRpbjpPcGVuU2VzYW1l ID: 4

Slide 110

Slide 110

GET /

HTTP/1.1 Host: square.com:443 User-Agent: okhttp/3.7.0 Accept: application/json Authorization: Basic QWxhZGRpbjpPcGVuU2VzYW1l Client Server HTTP/1.1 200 OK Content-Type: application/json Content-Length: 42 E-Tag: "686897696a7c876b7e" Last-Modified: Thu, 20 Apr 2017 12:45:26 GMT

{"id":1234,"amount":4200,"currency":"USD"} ID: 2 ID: 2 GET /api/payments

HTTP/1.1 Host: square.com:443 User-Agent: okhttp/3.7.0 Accept: application/json Authorization: Basic QWxhZGRpbjpPcGVuU2VzYW1l ID: 4

Slide 111

Slide 111

GET /

HTTP/1.1 Host: square.com:443 User-Agent: okhttp/3.7.0 Accept: application/json Authorization: Basic QWxhZGRpbjpPcGVuU2VzYW1l Client Server HTTP/1.1 200 OK Content-Type: application/json Content-Length: 42 E-Tag: "686897696a7c876b7e" Last-Modified: Thu, 20 Apr 2017 12:45:26 GMT

{"id":1234,"amount":4200,"currency":"USD"} ID: 2 ID: 2

Slide 112

Slide 112

GET /

HTTP/1.1 Host: square.com:443 User-Agent: okhttp/3.7.0 Accept: application/json Authorization: Basic QWxhZGRpbjpPcGVuU2VzYW1l Client Server HTTP/1.1 200 OK Content-Type: application/json Content-Length: 42 E-Tag: "686897696a7c876b7e" Last-Modified: Thu, 20 Apr 2017 12:45:26 GMT ID: 2 ID: 2 {"id":1234,"amount":4200,"currency":"USD"} ID: 2

Slide 113

Slide 113

GET /

HTTP/1.1 Host: square.com:443 User-Agent: okhttp/3.7.0 Accept: application/json Authorization: Basic QWxhZGRpbjpPcGVuU2VzYW1l Client Server HTTP/1.1 200 OK Content-Type: application/json Content-Length: 42 E-Tag: "686897696a7c876b7e" Last-Modified: Thu, 20 Apr 2017 12:45:26 GMT ID: 2 ID: 2 {"id":1234,"amount":420 ID: 2 0,"currency":"USD"} ID: 2

Slide 114

Slide 114

GET /

HTTP/1.1 Host: square.com:443 User-Agent: okhttp/3.7.0 Accept: application/json Authorization: Basic QWxhZGRpbjpPcGVuU2VzYW1l Client Server HTTP/1.1 200 OK Content-Type: application/json Content-Length: 42 E-Tag: "686897696a7c876b7e" Last-Modified: Thu, 20 Apr 2017 12:45:26 GMT ID: 2 ID: 2 {"id":1234,"amount":420 ID: 2 [1234,1275,1690,2641,2903,49 ID: 4

Slide 115

Slide 115

GET /

HTTP/1.1 Host: square.com:443 User-Agent: okhttp/3.7.0 Accept: application/json Authorization: Basic QWxhZGRpbjpPcGVuU2VzYW1l Client Server HTTP/1.1 200 OK Content-Type: application/json Content-Length: 42 E-Tag: "686897696a7c876b7e" Last-Modified: Thu, 20 Apr 2017 12:45:26 GMT ID: 2 ID: 2 {"id":1234,"amount":420 ID: 2 0,"currency":"USD"} ID: 2

Slide 116

Slide 116

GET /

HTTP/1.1 Host: square.com:443 User-Agent: okhttp/3.7.0 Accept: application/json Authorization: Basic QWxhZGRpbjpPcGVuU2VzYW1l HTTP/1.1 200 OK Content-Type: application/json Content-Length: 42 E-Tag: "686897696a7c876b7e" Last-Modified: Thu, 20 Apr 2017 12:45:26 GMT ID: 2 ID: 2 ID: 2 GET /api/payments

HTTP/1.1 Host: square.com:443 User-Agent: okhttp/3.7.0 Accept: application/json Authorization: Basic QWxhZGRpbjpPcGVuU2VzYW1l ID: 4 Client Server

Slide 117

Slide 117

GET /

HTTP/1.1 Host: square.com:443 User-Agent: okhttp/3.7.0 Accept: application/json Authorization: Basic QWxhZGRpbjpPcGVuU2VzYW1l HTTP/1.1 200 OK Content-Type: application/json Content-Length: 42 E-Tag: "686897696a7c876b7e" Last-Modified: Thu, 20 Apr 2017 12:45:26 GMT ID: 2 ID: 2 ID: 2 GET /api/payments

HTTP/1.1 Host: square.com:443 User-Agent: okhttp/3.7.0 Accept: application/json Authorization: Basic QWxhZGRpbjpPcGVuU2VzYW1l ID: 4 Client Server

Slide 118

Slide 118

GET / HTTP/1.1 Host: square.com:443 User-Agent: okhttp/3.7.0

Accept: application/json

Authorization: Basic QWxhZGRpbjpPcGVuU2VzYW1l HTTP/1.1 200 OK Content-Type: application/json Content-Length: 42 E-Tag: "686897696a7c876b7e" Last-Modified: Thu, 20 Apr 2017 12:45:26 GMT ID: 2 ID: 2 ID: 2 GET /api/payments HTTP/1.1 Host: square.com:443 User-Agent: okhttp/3.7.0

Accept: application/json

Authorization: Basic QWxhZGRpbjpPcGVuU2VzYW1l ID: 4 Client Server

Slide 119

Slide 119

GET / HTTP/1.1 0x25: square.com:443 User-Agent: okhttp/3.7.0

Accept: application/json

Authorization: Basic QWxhZGRpbjpPcGVuU2VzYW1l HTTP/1.1 200 OK Content-Type: application/json Content-Length: 42 E-Tag: "686897696a7c876b7e" Last-Modified: Thu, 20 Apr 2017 12:45:26 GMT ID: 2 ID: 2 ID: 2 GET /api/payments HTTP/1.1 0x25: square.com:443 User-Agent: okhttp/3.7.0

Accept: application/json

Authorization: Basic QWxhZGRpbjpPcGVuU2VzYW1l ID: 4 Client Server

Slide 120

Slide 120

GET / HTTP/1.1 0x25: square.com:443 0x39: okhttp/3.7.0

Accept: application/json

Authorization: Basic QWxhZGRpbjpPcGVuU2VzYW1l HTTP/1.1 200 OK Content-Type: application/json Content-Length: 42 E-Tag: "686897696a7c876b7e" Last-Modified: Thu, 20 Apr 2017 12:45:26 GMT ID: 2 ID: 2 ID: 2 GET /api/payments HTTP/1.1 0x25: square.com:443 0x39: okhttp/3.7.0

Accept: application/json

Authorization: Basic QWxhZGRpbjpPcGVuU2VzYW1l ID: 4 Client Server

Slide 121

Slide 121

GET / HTTP/1.1 0x25: square.com:443 0x39: okhttp/3.7.0

0x12: application/json

Authorization: Basic QWxhZGRpbjpPcGVuU2VzYW1l HTTP/1.1 200 OK Content-Type: application/json Content-Length: 42 E-Tag: "686897696a7c876b7e" Last-Modified: Thu, 20 Apr 2017 12:45:26 GMT ID: 2 ID: 2 ID: 2 GET /api/payments HTTP/1.1 0x25: square.com:443 0x39: okhttp/3.7.0

0x12: application/json

Authorization: Basic QWxhZGRpbjpPcGVuU2VzYW1l ID: 4 Client Server

Slide 122

Slide 122

GET / HTTP/1.1 0x25: square.com:443 0x39: okhttp/3.7.0

0x12: application/json

0x16: Basic QWxhZGRpbjpPcGVuU2VzYW1l HTTP/1.1 200 OK 0x1E: application/json 0x1B: 42 0x21: "686897696a7c876b7e" 0x2B: Thu, 20 Apr 2017 12:45:26 GMT ID: 2 ID: 2 ID: 2 GET /api/payments HTTP/1.1 0x25: square.com:443 0x39: okhttp/3.7.0

0x12: application/json

0x16: Basic QWxhZGRpbjpPcGVuU2VzYW1l ID: 4 Client Server

Slide 123

Slide 123

GET / HTTP/1.1 0x25: square.com:443 0x39: okhttp/3.7.0 0x12: application/json 0x16: Basic QWxhZGRpbjpPcGVuU2VzYW1l HTTP/1.1 200 OK 0x1E: application/json 0x1B: 42 0x21: "686897696a7c876b7e" 0x2B: Thu, 20 Apr 2017 12:45:26 GMT ID: 2 ID: 2 ID: 2 GET /api/payments HTTP/1.1 0x25: square.com:443 0x39: okhttp/3.7.0 0x12: application/json 0x16: Basic QWxhZGRpbjpPcGVuU2VzYW1l ID: 4 Client Server

Slide 124

Slide 124

GET / HTTP/1.1 0x25: square.com:443 0x39: okhttp/3.7.0 0x12: application/json 0x16: Basic QWxhZGRpbjpPcGVuU2VzYW1l HTTP/1.1 200 OK 0x1E: application/json 0x1B: 42 0x21: "686897696a7c876b7e" 0x2B: Thu, 20 Apr 2017 12:45:26 GMT ID: 2 ID: 2 ID: 2 GET /api/payments HTTP/1.1 0x25: 0x01 0x39: okhttp/3.7.0 0x12: application/json 0x16: Basic QWxhZGRpbjpPcGVuU2VzYW1l ID: 4 Client Server

Slide 125

Slide 125

GET / HTTP/1.1 0x25: square.com:443 0x39: okhttp/3.7.0 0x12: application/json 0x16: Basic QWxhZGRpbjpPcGVuU2VzYW1l HTTP/1.1 200 OK 0x1E: application/json 0x1B: 42 0x21: "686897696a7c876b7e" 0x2B: Thu, 20 Apr 2017 12:45:26 GMT ID: 2 ID: 2 ID: 2 GET /api/payments HTTP/1.1 0x25: 0x01 0x39: 0x02 0x12: application/json 0x16: Basic QWxhZGRpbjpPcGVuU2VzYW1l ID: 4 Client Server

Slide 126

Slide 126

GET / HTTP/1.1 0x25: square.com:443 0x39: okhttp/3.7.0 0x12: application/json 0x16: Basic QWxhZGRpbjpPcGVuU2VzYW1l HTTP/1.1 200 OK 0x1E: application/json 0x1B: 42 0x21: "686897696a7c876b7e" 0x2B: Thu, 20 Apr 2017 12:45:26 GMT ID: 2 ID: 2 ID: 2 GET /api/payments HTTP/1.1 0x25: 0x01 0x39: 0x02 0x12: 0x03 0x16: Basic QWxhZGRpbjpPcGVuU2VzYW1l ID: 4 Client Server

Slide 127

Slide 127

GET / HTTP/1.1 0x25: square.com:443 0x39: okhttp/3.7.0 0x12: application/json 0x16: Basic QWxhZGRpbjpPcGVuU2VzYW1l ID: 2 HTTP/1.1 200 OK 0x1E: application/json 0x1B: 42 0x21: "686897696a7c876b7e" 0x2B: Thu, 20 Apr 2017 12:45:26 GMT ID: 2 ID: 2 GET /api/payments HTTP/1.1 0x25: 0x01 0x39: 0x02 0x12: 0x03 0x16: 0x04 ID: 4 Client Server

Slide 128

Slide 128

GET / HTTP/1.1 0x25: square.com:443 0x39: okhttp/3.7.0 0x12: application/json 0x16: Basic QWxhZGRpbjpPcGVuU2VzYW1l ID: 2 HTTP/1.1 200 OK 0x1E: application/json 0x1B: 42 0x21: "686897696a7c876b7e" 0x2B: Thu, 20 Apr 2017 12:45:26 GMT ID: 2 ID: 2 GET /api/payments HTTP/1.1 0x25: 0x01 0x39: 0x02 0x12: 0x03 0x16: 0x04 ID: 4 Client Server

Slide 129

Slide 129

HTTP/1.1 200 OK 0x1E: application/json 0x1B: 42 0x21: "686897696a7c876b7e" 0x2B: Thu, 20 Apr 2017 12:45:26 GMT ID: 2 {"id":1234,"amount":420 ID: 2 0,"currency":"USD"} ID: 2 GET /api/payments HTTP/1.1 0x25: 0x01 0x39: 0x02 0x12: 0x03 0x16: 0x04 HTTP/1.1 200 OK 0x1E: application/json 0x1B: 471 0x21: "ae7284b30ccc93 " 0x2B: Wed, 19 Apr 2017 09:22:09 GMT ID: 4 Client Server

Slide 130

Slide 130

HTTP/1.1 200 OK 0x1E: application/json 0x1B: 42 0x21: "686897696a7c876b7e" 0x2B: Thu, 20 Apr 2017 12:45:26 GMT ID: 2 {"id":1234,"amount":420 ID: 2 0,"currency":"USD"} ID: 2 GET /api/payments HTTP/1.1 0x25: 0x01 0x39: 0x02 0x12: 0x03 0x16: 0x04 HTTP/1.1 200 OK 0x1E: application/json 0x1B: 471 0x21: "ae7284b30ccc93 " 0x2B: Wed, 19 Apr 2017 09:22:09 GMT ID: 4 Client Server

Slide 131

Slide 131

0x08 0x1E: application/json 0x1B: 42 0x21: "686897696a7c876b7e" 0x2B: Thu, 20 Apr 2017 12:45:26 GMT ID: 2 {"id":1234,"amount":420 ID: 2 0,"currency":"USD"} ID: 2 GET /api/payments HTTP/1.1 0x25: 0x01 0x39: 0x02 0x12: 0x03 0x16: 0x04 0x08 0x1E: application/json 0x1B: 471 0x21: "ae7284b30ccc93 " 0x2B: Wed, 19 Apr 2017 09:22:09 GMT ID: 4 Client Server

Slide 132

Slide 132

0x08 0x1E: application/json 0x1B: 42 0x21: "686897696a7c876b7e" 0x2B: Thu, 20 Apr 2017 12:45:26 GMT ID: 2 {"id":1234,"amount":420 ID: 2 0,"currency":"USD"} ID: 2 GET /api/payments HTTP/1.1 0x25: 0x01 0x39: 0x02 0x12: 0x03 0x16: 0x04 0x08 0x1E: 0x1A 0x1B: 471 0x21: "ae7284b30ccc93 " 0x2B: Wed, 19 Apr 2017 09:22:09 GMT ID: 4 Client Server

Slide 133

Slide 133

0x08 0x1E: application/json 0x1B: 42 0x21: "686897696a7c876b7e" 0x2B: Thu, 20 Apr 2017 12:45:26 GMT ID: 2 {"id":1234,"amount":420 ID: 2 0,"currency":"USD"} ID: 2 GET /api/payments HTTP/1.1 0x25: 0x01 0x39: 0x02 0x12: 0x03 0x16: 0x04 0x08 0x1E: 0x1A 0x1B: 471 0x21: "ae7284b30ccc93 " 0x2B: Wed, 19 Apr 2017 09:22:09 GMT ID: 4 Client Server

Slide 134

Slide 134

Client Server ID: 2 GET / HTTP/1.1 0x25: square.com:443 0x39: okhttp/3.7.0 0x12: application/json 0x16 : Basic QWxhZGRpbjpPcGVuU2VzYW1l ID: 2 0x08 0x1E: application/json 0x1B: 42 0x21: "686897696a7c876b7e" 0x2B: Thu, 20 Apr 2017 12:45:26 GMT ID: 2 {"id":1234,"amount":420 ID: 2 0,"currency":"USD"} ID: 4 GET /api/payments HTTP/1.1 0x25: 0x01 0x39: 0x02 0x12: 0x03 0x16: 0x04 ID: 4 0x08 0x1E: 0x1A 0x1B: 471 0x21: "ae7284b30ccc93 " 0x2B: Wed, 19 Apr 2017 09:22:09 GMT

Slide 135

Slide 135

OkHttpClient client = new OkHttpClient() ;

Request request = new Request.Builder() .url( "https://twitter.com" ) .build() ; Call call = client.newCall(request) ; Response response = call.execute() ; System. out .println(response.protocol()) ;

Slide 136

Slide 136

OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder() .url("https://twitter.com ") .build(); Call call = client.newCall(request); Response response = call.execute(); System. out .println( response.protocol() );

Slide 137

Slide 137

OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder() .url("https://twitter.com ") .build(); Call call = client.newCall(request); Response response = call.execute(); System. out .println( response.protocol() ); h2

Slide 138

Slide 138

Payloads {"id":1234,"amount":4200,"currency":"USD"}

Slide 139

Slide 139

{"id":1234,"amount":4200,"currency":"USD"} JSON

Slide 140

Slide 140

{"id":1234,"amount":4200,"currency":"USD"} JSON message

Payment

{

string

id = 1 ;

int32

amount = 2 ;

Currency

currency = 3 ;

} enum

Currency {

USD = 1 ;

} Protocol Buffers

Slide 141

Slide 141

{"id":1234,"amount":4200,"currency":"USD"} JSON message

Payment

{

string

id = 1 ;

int32

amount = 2 ;

Currency

currency = 3 ;

} enum

Currency {

USD = 1 ;

} Protocol Buffers 1=1234 2=4200 3=1

Slide 142

Slide 142

{"id":1234,"amount":4200,"currency":"USD"} JSON message

Payment

{

string

id = 1 ;

int32

amount = 2 ;

Currency

currency = 3 ;

} enum

Currency {

USD = 1 ;

} Protocol Buffers 1=1234 2=4200 3=1 0104D20210680301

Slide 143

Slide 143

{"id":1234,"amount":4200,"currency":"USD"} JSON message

Payment

{

string

id = 1 ;

int32

amount = 2 ;

Currency

currency = 3 ;

} enum

Currency {

USD = 1 ;

} Protocol Buffers

Slide 144

Slide 144

Y {"id":1234,"amount":4200,"currency":"USD"} Y

Slide 145

Slide 145

Y { "id":1234, "amount":4200, "currency":"USD" } Y

Slide 146

Slide 146

Y {"id":1234,"amount":4200,"currency":"USD"} Y

Slide 147

Slide 147

Y { "id":1234,"amount":4200,"currency":"USD"} Y

Slide 148

Slide 148

Y { " id":1234,"amount":4200,"currency":"USD"} Y

Slide 149

Slide 149

Y { " id " :1234,"amount":4200,"currency":"USD"} Y

Slide 150

Slide 150

Y {"id": 1234,"amount":4200,"currency":"USD"} Y id

Slide 151

Slide 151

Y {"id": 1234,"amount":4200,"currency":"USD"} Y String(id)

Slide 152

Slide 152

Y {"id": 1234,"amount":4200,"currency":"USD"} Y String(id) Map<String, Adapter<?>>

Slide 153

Slide 153

Y {"id": 1234,"amount":4200,"currency":"USD"} Y String(id) Map<String, Adapter<?>> Adapter<Long>

Slide 154

Slide 154

Y {"id": 1234,"amount":4200,"currency":"USD"} Y String(id) Map<String, Adapter<?>> Adapter<Long>

Slide 155

Slide 155

Y {"id": 1234 ,"amount":4200,"currency":"USD"} Y String(id) Map<String, Adapter<?>> Adapter<Long>

Slide 156

Slide 156

Y {"id":1234 ,"amount":4200,"currency":"USD"} Y String(id) Map<String, Adapter<?>> Adapter<Long> 1234L

Slide 157

Slide 157

Y {"id":1234 ,"amount":4200,"currency":"USD"} Y 1234L

Slide 158

Slide 158

Y {"id":1234 , "amount":4200,"currency":"USD"} Y 1234L

Slide 159

Slide 159

Y {"id":1234, " amount":4200,"currency":"USD"} Y 1234L

Slide 160

Slide 160

Y {"id":1234, " amount " :4200,"currency":"USD"} Y 1234L

Slide 161

Slide 161

Y {"id":1234,"amount": 4200,"currency":"USD"} Y 1234L String(amount)

Slide 162

Slide 162

Y {"id":1234,"amount": 4200,"currency":"USD"} Y 1234L String(amount) Map<String, Adapter<?>>

Slide 163

Slide 163

Y {"id":1234,"amount": 4200,"currency":"USD"} Y 1234L String(amount) Map<String, Adapter<?>> Adapter<Long>

Slide 164

Slide 164

Y {"id":1234,"amount": 4200,"currency":"USD"} Y 1234L String(amount) Map<String, Adapter<?>> Adapter<Long>

Slide 165

Slide 165

Y {"id":1234,"amount": 4200 ,"currency":"USD"} Y 1234L String(amount) Map<String, Adapter<?>> Adapter<Long>

Slide 166

Slide 166

Y {"id":1234,"amount":4200 ,"currency":"USD"} Y 1234L String(amount) Map<String, Adapter<?>> Adapter<Long> 4200L

Slide 167

Slide 167

Y {"id":1234,"amount":4200 ,"currency":"USD"} Y 1234L 4200L

Slide 168

Slide 168

Y {"id":1234,"amount":4200 , "currency":"USD"} Y 1234L 4200L

Slide 169

Slide 169

Y {"id":1234,"amount":4200, " currency":"USD"} Y 1234L 4200L

Slide 170

Slide 170

Y {"id":1234,"amount":4200, " currency " :"USD"} Y 1234L 4200L

Slide 171

Slide 171

Y {"id":1234,"amount":4200,"currency": "USD"} Y 1234L String(currency) 4200L

Slide 172

Slide 172

Y {"id":1234,"amount":4200,"currency": "USD"} Y 1234L String(currency) Map<String, Adapter<?>> 4200L

Slide 173

Slide 173

Y {"id":1234,"amount":4200,"currency": "USD"} Y 1234L String(currency) Map<String, Adapter<?>> Adapter<CurrencyCode> 4200L

Slide 174

Slide 174

Y {"id":1234,"amount":4200,"currency": "USD"} Y 1234L String(currency) Map<String, Adapter<?>> Adapter<CurrencyCode> 4200L

Slide 175

Slide 175

Y {"id":1234,"amount":4200,"currency": "USD" } Y 1234L String(currency) Map<String, Adapter<?>> 4200L Adapter<CurrencyCode>

Slide 176

Slide 176

Y {"id":1234,"amount":4200,"currency":"USD" } Y 1234L String(currency) Map<String, Adapter<?>> 4200L 4200L Adapter<CurrencyCode> CurrencyCode.USD

Slide 177

Slide 177

Y {"id":1234,"amount":4200,"currency":"USD" } Y 1234L 4200L CurrencyCode.USD

Slide 178

Slide 178

Y {"id":1234,"amount":4200,"currency":"USD" } Y 1234L 4200L CurrencyCode.USD

Slide 179

Slide 179

Y {"id":1234,"amount":4200,"currency":"USD"} Y 1234L 4200L CurrencyCode.USD

Slide 180

Slide 180

[

Y {"id":1234,"amount":4200,"currency":"USD"}, Y

{"id":1275,"amount":10000,"currency":"USD"}, {"id":1690,"amount":834,"currency":"USD"}, {"id":2641,"amount":2448,"currency":"USD"}, {"id":2903,"amount":11305,"currency":"USD"}, {"id":4991,"amount":566,"currency":"USD"}, {"id":5312,"amount":702,"currency":"USD"}, {"id":5319,"amount":3885,"currency":"USD"}, {"id":14328,"amount":34400,"currency":"USD"}, {"id":28321,"amount":892,"currency":"USD"}, {"id":29948,"amount":2261,"currency":"USD"}, {"id":30991,"amount":6600,"currency":"USD"}, {"id":37174,"amount":939,"currency":"USD"}, {"id":73572,"amount":40000,"currency":"USD"} ]

Slide 181

Slide 181

Y {"id":1234,"amount":4200,"currency":"USD"} Y

Slide 182

Slide 182

Y {"id":1234,"amount":4200,"currency":"USD"} Y ByteString("amount") ByteString("currency") ByteString("id")

Slide 183

Slide 183

Y { "id":1234,"amount":4200,"currency":"USD"} Y ByteString("amount") ByteString("currency") ByteString("id")

Slide 184

Slide 184

Y { " id":1234,"amount":4200,"currency":"USD"} Y ByteString("amount") ByteString("currency") ByteString("id")

Slide 185

Slide 185

Y { " id":1234,"amount":4200,"currency":"USD"} Y ByteString( " amount") ByteString( " currency") ByteString( " id")

Slide 186

Slide 186

Y { "i d":1234,"amount":4200,"currency":"USD"} Y ByteString( " a mount") ByteString( " c urrency") ByteString( "i d")

Slide 187

Slide 187

Y { "i d":1234,"amount":4200,"currency":"USD"} Y ByteString("amount") ByteString("currency") ByteString( "i d")

Slide 188

Slide 188

Y { "id ":1234,"amount":4200,"currency":"USD"} Y ByteString("amount") ByteString("currency") ByteString( "id ")

Slide 189

Slide 189

Y { "id" :1234,"amount":4200,"currency":"USD"} Y ByteString("amount") ByteString("currency") ByteString( "id" )

Slide 190

Slide 190

Y {"id": 1234,"amount":4200,"currency":"USD"} Y ByteString("amount") ByteString("currency") ByteString( "id" ) Adapter<Long> Adapter<CurrencyCode> Adapter<Long>

Slide 191

Slide 191

Y {"id": 1234,"amount":4200,"currency":"USD"} Y ByteString("amount") ByteString("currency") ByteString( "id" ) Adapter<Long> Adapter<CurrencyCode> Adapter<Long>

Slide 192

Slide 192

Y {"id": 1234,"amount":4200,"currency":"USD"} Y ByteString("amount") ByteString("currency") ByteString( "id" ) Adapter<Long> Adapter<CurrencyCode> Adapter<Long>

Slide 193

Slide 193

Y {"id":1234,"amount":4200,"currency":"USD"} Y ByteString("amount") ByteString("currency") ByteString("id") Adapter<Long> Adapter<CurrencyCode> Adapter<Long> Adapter<Payment>

Slide 194

Slide 194

[

Y {"id":1234,"amount":4200,"currency":"USD"}, Y

{"id":1275,"amount":10000,"currency":"USD"}, {"id":1690,"amount":834,"currency":"USD"}, {"id":2641,"amount":2448,"currency":"USD"}, {"id":2903,"amount":11305,"currency":"USD"}, {"id":4991,"amount":566,"currency":"USD"}, {"id":5312,"amount":702,"currency":"USD"}, {"id":5319,"amount":3885,"currency":"USD"}, {"id":14328,"amount":34400,"currency":"USD"}, {"id":28321,"amount":892,"currency":"USD"}, ByteString("amount") ByteString("currency") ByteString("id") Adapter<Long> Adapter<CurrencyCode> Adapter<Long> Adapter<Payment>

Slide 195

Slide 195

github.com/square/moshi

Slide 196

Slide 196

WebSocket Client Server

Slide 197

Slide 197

WebSocket Client Server GET / HTTP/1.1 S prechen sie websocket?

Slide 198

Slide 198

WebSocket Client Server GET / HTTP/1.1 HTTP/1.1 101 ¡ Sí!

Slide 199

Slide 199

WebSocket Client Server GET / HTTP/1.1 HTTP/1.1 101

Slide 200

Slide 200

WebSocket Client Server GET / HTTP/1.1 HTTP/1.1 101

Slide 201

Slide 201

WebSocket Client Server GET / HTTP/1.1 HTTP/1.1 101

Slide 202

Slide 202

Slide 203

Slide 203

Slide 204

Slide 204

Slide 205

Slide 205

Slide 206

Slide 206

Slide 207

Slide 207

Death, Taxes, and HTTP @JesseWilson @JakeWha ! on