HttpClient.newHttpClient() .send(HttpRequest.newBuilder() .version(HttpClient.Version.HTTP_2) .uri(URI.create("http://localhost:8070")) .GET() .build(), HttpResponse.BodyHandlers.ofString()); +-------------------------------------------------+ | 0 1 2 3 4 5 6 7 8 9 a b c d e f | +--------+-------------------------------------------------+----------------+ |00000000| 47 45 54 20 2f 20 48 54 54 50 2f 31 2e 31 0d 0a |GET / HTTP/1.1..| |00000010| 43 6f 6e 6e 65 63 74 69 6f 6e 3a 20 55 70 67 72 |Connection: Upgr| |00000020| 61 64 65 2c 20 48 54 54 50 32 2d 53 65 74 74 69 |ade, HTTP2-Setti| |00000030| 6e 67 73 0d 0a 43 6f 6e 74 65 6e 74 2d 4c 65 6e |ngs..Content-Len| |00000040| 67 74 68 3a 20 30 0d 0a 48 6f 73 74 3a 20 6c 6f |gth: 0..Host: lo| |00000050| 63 61 6c 68 6f 73 74 3a 38 30 37 30 0d 0a 48 54 |calhost:8070..HT| |00000060| 54 50 32 2d 53 65 74 74 69 6e 67 73 3a 20 41 41 |TP2-Settings: AA| |00000070| 45 41 41 45 41 41 41 41 49 41 41 41 41 42 41 41 |EAAEAAAAIAAAABAA| |00000080| 4d 41 41 41 42 6b 41 41 51 42 41 41 41 41 41 41 |MAAABkAAQBAAAAAA| |00000090| 55 41 41 45 41 41 0d 0a 55 70 67 72 61 64 65 3a |UAAEAA..Upgrade:| |000000a0| 20 68 32 63 0d 0a 55 73 65 72 2d 41 67 65 6e 74 | h2c..User-Agent| |000000b0| 3a 20 4a 61 76 61 2d 68 74 74 70 2d 63 6c 69 65 |: Java-http-clie| |000000c0| 6e 74 2f 31 37 2e 30 2e 31 0d 0a 0d 0a |nt/17.0.1.... | +--------+-------------------------------------------------+----------------+ curl --http2-prior-knowledge localhost:8070 +-------------------------------------------------+ | 0 1 2 3 4 5 6 7 8 9 a b c d e f | +--------+-------------------------------------------------+----------------+ |00000000| 50 52 49 20 2a 20 48 54 54 50 2f 32 2e 30 0d 0a |PRI * HTTP/2.0..| |00000010| 0d 0a 53 4d 0d 0a 0d 0a 00 00 12 04 00 00 00 00 |..SM............| |00000020| 00 00 03 00 00 00 64 00 04 40 00 00 00 00 02 00 |......d..@......| |00000030| 00 00 00 00 00 04 08 00 00 00 00 00 3f ff 00 01 |............?...| |00000040| 00 00 1e 01 05 00 00 00 01 82 84 86 41 8a a0 e4 |............A...| |00000050| 1d 13 9d 09 b8 f0 1d 07 7a 88 25 b6 50 c3 ab b6 |........z.%.P...| |00000060| f2 e0 53 03 2a 2f 2a |..S.*/* | +--------+-------------------------------------------------+----------------+