It is possible to method to add raw bytes towards the publish parameters using Apache's HTTPClient? My motivation would be to stream the raw bytes of the stream inside a particular encoding after which test what goes on to that particular data if this reaches the server.

edit: I observed that Apache includes a deprecated method to increase the request body utilizing an inputstream, and so i could feed mtss is a ByteArrayInputStream, but can there be anything better/ not deprecated?

(You did not specify, so I am presuming you're using Apache HttpClient version 4.x)

I do not think you are able to "add" raw bytes for an normally create request's Publish parameters.

However, it ought to be possible to produce a PostMethod by having an HttpEntity featuring its legitimate parameters, and several improperly encoded stuff. You may want to perform the formatting and encoding from the content yourself, however, you might have the ability to have a short-cut by putting the valid parameters right into a UrlEncodedFormEntity, after which while using writeTo approach to extract the formatted/encoded version right into a ByteArrayOutputStream. After you have compromised this content bytes, using them as a ByteArrayEntity instance using the appropriate content type and encoding parameters.

It will likely be untidy ...