简体   繁体   中英

unit testing java servlets with binary data

I'm attempting to write a Java Servlet unit test to send binary data http requests to the servlet and receive a binary response. Usually I use the jetty ServletTester and HttpTester to unit test servlets, but HttpTester doesn't seems to support binary requests yet.

Any ideas how can I unit test a binary servlet in java?

Seems in Jetty 8 HttpTester store content in binary format.

You may extend HttpTester and set _genContent manually(it is protected). Or you can interpret the bytes as String with the same charset as in HttpTester.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM