I believe the call is being dispatched as soon as the headers arrive because in the ‘tcpdump’ trace I see only the headers go out and immediately the response comes back (with an error). See below for a (lightly censored) example out of the trace:
16:22:30.919766 IP pdirks-dev-linux.eng.vmware.com.49250 > pdirks-dev-linux.eng.vmware.com.http-alt: Flags [P.], seq 1:207, ack
1, win 342, options [nop,nop,TS val 3457687594 ecr 3457687594], length 206: HTTP: PUT /VMware-XXX/XXX-backend/1.0/hosts HTTP/1.1
0x0000: 4500 0102 09aa 4000 4006 ea65 0a14 98df E.....@.@..e....
0x0010: 0a14 98df c062 1f90 2b24 0906 cfec aed1 .....b..+$......
0x0020: 8018 0156 46db 0000 0101 080a ce18 202a ...VF..........*
0x0030: ce18 202a 5055 5420 2f56 4d77 6172 652d ...*PUT./VMware-
0x0040: 5858 582f 5858 582d 6261 636b 656e 642f XXX/XXX-backend/
0x0050: 312e 302f 686f 7374 7320 4854 5450 2f31 1.0/hosts.HTTP/1
0x0060: 2e31 0d0a 486f 7374 3a20 7064 6972 6b73 .1..Host:.pdirks
0x0070: 2d64 6576 2d6c 696e 7578 2e65 6e67 2e76 -dev-linux.eng.v
0x0080: 6d77 6172 652e 636f 6d3a 3830 3830 0d0a mware.com:8080..
0x0090: 4163 6365 7074 3a61 7070 6c69 6361 7469 Accept:applicati
0x00a0: 6f6e 2f6a 736f 6e0d 0a43 6f6e 7465 6e74 on/json..Content
0x00b0: 2d4c 656e 6774 683a 3139 0d0a 436f 6e74 -Length:19..Cont
0x00c0: 656e 742d 5479 7065 3a61 7070 6c69 6361 ent-Type:applica
0x00d0: 7469 6f6e 2f6a 736f 6e0d 0a55 7365 722d tion/json..User-
0x00e0: 4167 656e 743a 0d0a 436f 6e6e 6563 7469 Agent:..Connecti
0x00f0: 6f6e 3a20 4b65 6570 2d41 6c69 7665 0d0a on:.Keep-Alive..
0x0100: 0d0a ..
16:22:30.923503 IP pdirks-dev-linux.eng.vmware.com.http-alt > pdirks-dev-linux.eng.vmware.com.49250: Flags [P.], seq 1:248, ack
226, win 350, options [nop,nop,TS val 3457687598 ecr 3457687594], length 247: HTTP: HTTP/1.1 400 Bad Request
0x0000: 4500 012b ae7e 4000 4006 4568 0a14 98df E..+.~@.@.Eh....
0x0010: 0a14 98df 1f90 c062 cfec aed1 2b24 09e7 .......b....+$..
0x0020: 8018 015e 4704 0000 0101 080a ce18 202e ...^G...........
0x0030: ce18 202a 4854 5450 2f31 2e31 2034 3030 ...*HTTP/1.1.400
0x0040: 2042 6164 2052 6571 7565 7374 0d0a 4461 .Bad.Request..Da
0x0050: 7465 3a20 5375 6e2c 2032 3120 4170 7220 te:.Sun,.21.Apr.
0x0060: 3230 3139 2032 333a 3232 3a33 3020 474d 2019.23:22:30.GM
0x0070: 540d 0a41 6363 6573 732d 436f 6e74 726f T..Access-Contro
0x0080: 6c2d 416c 6c6f 772d 4f72 6967 696e 3a20 l-Allow-Origin:.
0x0090: 2a0d 0a41 6363 6573 732d 436f 6e74 726f *..Access-Contro
0x00a0: 6c2d 416c 6c6f 772d 4d65 7468 6f64 733a l-Allow-Methods:
0x00b0: 2047 4554 2c20 504f 5354 2c20 4445 4c45 .GET,.POST,.DELE
0x00c0: 5445 2c20 5055 540d 0a41 6363 6573 732d TE,.PUT..Access-
0x00d0: 436f 6e74 726f 6c2d 416c 6c6f 772d 4865 Control-Allow-He
0x00e0: 6164 6572 733a 2043 6f6e 7465 6e74 2d54 aders:.Content-T
0x00f0: 7970 650d 0a43 6f6e 7465 6e74 2d4c 656e ype..Content-Len
0x0100: 6774 683a 2030 0d0a 5365 7276 6572 3a20 gth:.0..Server:.
0x0110: 4a65 7474 7928 392e 332e 3236 2e76 3230 Jetty(9.3.26.v20
0x0120: 3139 3034 3033 290d 0a0d 0a 190403)....
Interestingly, I see a “PUSH” flag set on the “PUT” packet and I don’t even see the rest of the body in another packet this time, so that suggests the difference is not just 1 vs. 2 packets but some other issue generating a properly formatted
body (although it could also be the server dropping the connection before the client gets around to sending it). Note, though, that the header has “Content-Length:19” which is exactly what I would expect for the length of a properly formatted “{“host-id”:"goofy”}”
packet ?
FWIW I don’t get as far as a NPE - I have some logging that logs when a null pointer comes in to the server stub and it decides to reject the call with 400 error (“BAD REQUEST”) so I’m 100% sure my stub is, in fact, being called with a null pointer
for the body parameter, whereas with Postman it works as expected, comes in with a non-null pointer, and sees what it expects to see in the body parameter and completes normally.