I am developing a android network capture app with vpnservice.And now I hava a ByteBuffer which receive the raw request or response string from a SocketChannel. The raw string like this:
request:
POST /rest/sur?ak=23419966&av=5.14.2&c=0&v=3.0&s=7da28be1d2234f74c58ea291b9ec0600599fce72&d=VU2t9gm55TADAL4lAcpxR%2FPQ&sv=4.3.9&p=a&t=1482566260805&u=&is=1 HTTP/1.1
Connection: Keep-Alive
Content-Type: multipart/form-data; boundary=GJircTeP
Content-Length: 435
User-Agent: Dalvik/1.6.0 (Linux; U; Android 4.4.2; Che2-TL00 Build/HonorChe2-TL00)
Host: adash.m.taobao.com
Accept-Encoding: gzip
--GJircTeP
Content-Disposition: form-data; name="stm_p"; filename="stm_p"
Content-Type: application/octet-stream
........some messy code(request data)
response
HTTP/1.1 200 OK
Date: Sat, 24 Dec 2016 08:03:23 GMT
Content-Type: application/json
Transfer-Encoding: chunked
Connection: close
31
{"t":1482566603503,"ret":"","success":"success"}
0
nt-Type: multipart/form-data; boundary=GJircTeP
Content-Length: 461
User-Agent: Dalvik/1.6.0 (Linux; U; Android 4.4.2; Che2-TL00 Build/HonorChe2-TL00)
Host: adash.m.taobao.com
Accept-Encoding: gzip
--GJircTeP
Content-Disposition: form-data; name="stm_p"; filename="stm_p"
Content-Type: application/octet-stream
........some messy code(response data)
my question is how to convert these raw string to a HttpRequest or HttpResponse?