有人可以解釋爲什麼這個httpunit測試用例在wc.getResponse中使用「壞文件描述符」保持失敗。我添加了is.close()作爲猜測,並在失敗之前和之後移動它,但沒有任何效果。此測試將請求發送到Dropwizard應用程序。httpunit PutMethodWebRequest拋出IOException;壞文件描述符
public class TestCircuitRequests
{
static WebConversation wc = new WebConversation();
static String url = "http://localhost:8888/funl/circuit/test.circuit1";
@Test
public void testPut() throws Exception
{
InputStream is = new FileInputStream("src/test/resources/TestCircuit.json");
WebRequest rq = new PutMethodWebRequest(url, is, "application/json");
wc.setAuthentication("FUNL", "foo", "bar");
WebResponse response = wc.getResponse(rq);
is.close();
}
無論如何,「壞文件描述符」是什麼意思? – Bradjcox
您可能想要查看httpunit開發者FAQ 以查看1.7.2版本是否有效。請檢查rev1099 https://sourceforge.net/mailarchive/forum.php?thread_name=5051BBF6.70700%40bitplan.com&forum_name=httpunit-develop –