MCPcopy
hub / github.com/dropbox/godropbox / TestRecvResponse

Method TestRecvResponse

memcache/raw_binary_client_test.go:167–244  ·  view source on GitHub ↗
(c *C)

Source from the content-addressed store, hash-verified

165}
166
167func (s *RawBinaryClientSuite) TestRecvResponse(c *C) {
168 /*
169 Byte/ 0 | 1 | 2 | 3 |
170 / | | | |
171 |0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7|
172 +---------------+---------------+---------------+---------------+
173 0| 0x81 | 0x09 | 0x00 | 0x05 |
174 +---------------+---------------+---------------+---------------+
175 4| 0x04 | 0x00 | 0x00 | 0x02 |
176 +---------------+---------------+---------------+---------------+
177 8| 0x00 | 0x00 | 0x00 | 0x0e |
178 +---------------+---------------+---------------+---------------+
179 12| 0x00 | 0x00 | 0x00 | 0x00 |
180 +---------------+---------------+---------------+---------------+
181 16| 0x00 | 0x00 | 0x00 | 0x00 |
182 +---------------+---------------+---------------+---------------+
183 20| 0x00 | 0x00 | 0x00 | 0x01 |
184 +---------------+---------------+---------------+---------------+
185 24| 0xde | 0xad | 0xbe | 0xef |
186 +---------------+---------------+---------------+---------------+
187 28| 0x48 ('H') | 0x65 ('e') | 0x6c ('l') | 0x6c ('l') |
188 +---------------+---------------+---------------+---------------+
189 32| 0x6f ('o') | 0x57 ('W') | 0x6f ('o') | 0x72 ('r') |
190 +---------------+---------------+---------------+---------------+
191 36| 0x6c ('l') | 0x64 ('d') |
192 +---------------+---------------+
193
194
195 Total 38 bytes (24 byte header, 4 byte extras, 5 byte key
196 and 5 byte value)
197
198
199 Field (offset) (value)
200 Magic (0) : respMagicByte
201 Opcode (1) : 0x09
202 Key length (2,3) : 0x0005
203 Extra length (4) : 0x04
204 Data type (5) : 0x00
205 Status (6,7) : 0x0002
206 Total body (8-11) : 0x0000000e
207 Opaque (12-15): 0x00000000
208 CAS (16-23): 0x0000000000000001
209 Extras :
210 Flags (24-27): 0xdeadbeef
211 Key (28-32): The textual string: "Hello"
212 Value (33-37): The textual string: "World"
213 */
214 var serializedResponseMessage = []byte{
215 respMagicByte, // magic
216 uint8(opGetQ), // op code
217 0x00, 0x05, // key length
218 0x04, // extras length
219 0x0, // data type
220 0x00, 0x02, // status
221 0x00, 0x00, 0x00, 0x0e, // total length
222 0x00, 0x00, 0x00, 0x00, // opaque
223 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, // cas
224 0xde, 0xad, 0xbe, 0xef, // flags

Callers

nothing calls this directly

Calls 2

receiveResponseMethod · 0.80
WriteMethod · 0.45

Tested by

no test coverage detected