APISonar


org.jboss.as.test.integration.management.Listener.HTTP

> org > jboss > as > test > integration > management > Listener > HTTP
org APIs jboss APIs as APIs test APIs integration APIs management APIs Listener APIs HTTP APIs

Example 1
public void testProxyProtocolOverHTTP() throws Exception {
        addListener(Listener.HTTP, true);
        try (Socket s = new Socket(url.getHost(), 8181)) {
            s.getOutputStream().write("PROXY TCP4 1.2.3.4 5.6.7.8 444 555\r\nGET /proxy/addr HTTP/1.0\r\n\r\n".getBytes(StandardCharsets.US_ASCII));
            String result = FileUtils.readFile(s.getInputStream());
            Assert.assertTrue(result, result.contains("result:1.2.3.4:444 5.6.7.8:555"));
        } finally {
            removeListener(Listener.HTTP);
        }
    }
Example 2
public void testHttpConnector() throws Exception {

        addListener(Listener.HTTP);

        // check that the connector is live
        String cURL = "http://" + url.getHost() + ":8181";
        String response = HttpRequest.get(cURL, 10, TimeUnit.SECONDS);
        assertTrue("Invalid response: " + response, response.indexOf("JBoss") >= 0);
        removeListener(Listener.HTTP, 5000);
    }