Java Code Examples for io.undertow.util.FileUtils#readFile()
The following examples show how to use
io.undertow.util.FileUtils#readFile() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ResponseWriterTestCase.java From quarkus-http with Apache License 2.0 | 6 votes |
@Test public void testWriterLargeResponse() throws Exception { TestHttpClient client = new TestHttpClient(); try { HttpGet get = new HttpGet(DefaultServer.getDefaultServerURL() + "/servletContext/large"); HttpResponse result = client.execute(get); Assert.assertEquals(StatusCodes.OK, result.getStatusLine().getStatusCode()); String data = FileUtils.readFile(result.getEntity().getContent()); String message = LargeResponseWriterServlet.getMessage(); //Assert.assertEquals(message.length(), data.length()); Assert.assertEquals(message, data); } finally { client.getConnectionManager().shutdown(); } }
Example 2
Source File: ResponseWriterTestCase.java From quarkus-http with Apache License 2.0 | 5 votes |
@Test public void testContentLengthBasedFlush() throws Exception { TestHttpClient client = new TestHttpClient(); try { HttpGet get = new HttpGet(DefaultServer.getDefaultServerURL() + "/servletContext/resp?test=" + ResponseWriterServlet.CONTENT_LENGTH_FLUSH); HttpResponse result = client.execute(get); Assert.assertEquals(StatusCodes.OK, result.getStatusLine().getStatusCode()); String data = FileUtils.readFile(result.getEntity().getContent()); Assert.assertEquals("first-aaaa", data); Assert.assertEquals(0, result.getHeaders("not-header").length); } finally { client.getConnectionManager().shutdown(); } }
Example 3
Source File: SimpleConfidentialRedirectTestCase.java From quarkus-http with Apache License 2.0 | 5 votes |
@ProxyIgnore public void testRedirectWithFullURLInPath() throws IOException { DefaultServer.isProxy(); //now we need to test what happens if the client send a full URI //see UNDERTOW-874 try (Socket socket = new Socket(DefaultServer.getHostAddress(), DefaultServer.getHostPort())) { socket.getOutputStream().write(("GET " + DefaultServer.getDefaultServerURL() + "/foo HTTP/1.0\r\n\r\n").getBytes(StandardCharsets.UTF_8)); String result = FileUtils.readFile(socket.getInputStream()); Assert.assertTrue(result.contains("Location: " + DefaultServer.getDefaultServerSSLAddress() + "/foo")); } }