List of usage examples for io.netty.handler.codec.http HttpMethod POST
HttpMethod POST
To view the source code for io.netty.handler.codec.http HttpMethod POST.
Click Source Link
From source file:org.wso2.carbon.transport.http.netty.contentaware.ContentAwareMessageProcessorTestCase.java
License:Open Source License
@Test public void messageEchoingFromProcessorTestCase() { String testValue = "Test Message"; try {//from w w w. j a v a 2 s . com HttpURLConnection urlConn = TestUtil.request(baseURI, "/", HttpMethod.POST.name(), true); TestUtil.writeContent(urlConn, testValue); assertEquals(200, urlConn.getResponseCode()); String content = TestUtil.getContent(urlConn); assertEquals(testValue, content); urlConn.disconnect(); } catch (IOException e) { TestUtil.handleException("IOException occurred while running messageEchoingFromProcessorTestCase", e); } }
From source file:org.wso2.carbon.transport.http.netty.contentaware.ContentAwareMessageProcessorTestCase.java
License:Open Source License
@Test public void requestResponseTransformFromProcessorTestCase() { String requestValue = "XXXXXXXX"; String responseValue = "YYYYYYY"; String expectedValue = responseValue + ":" + requestValue; try {/*from w w w . j a va2 s. c o m*/ httpConnectorListener = new RequestResponseTransformListener(responseValue, configuration); TestUtil.updateMessageProcessor(httpConnectorListener); HttpURLConnection urlConn = TestUtil.request(baseURI, "/", HttpMethod.POST.name(), true); TestUtil.writeContent(urlConn, requestValue); assertEquals(200, urlConn.getResponseCode()); String content = TestUtil.getContent(urlConn); assertEquals(expectedValue, content); urlConn.disconnect(); } catch (IOException e) { TestUtil.handleException( "IOException occurred while running requestResponseTransformFromProcessorTestCase", e); } }
From source file:org.wso2.carbon.transport.http.netty.contentaware.ContentAwareMessageProcessorTestCase.java
License:Open Source License
@Test public void requestResponseCreationFromProcessorTestCase() { String requestValue = "XXXXXXXX"; String responseValue = "YYYYYYY"; String expectedValue = responseValue + ":" + requestValue; try {//from w w w.ja v a2 s . c o m httpConnectorListener = new RequestResponseCreationListener(responseValue, configuration); TestUtil.updateMessageProcessor(httpConnectorListener); HttpURLConnection urlConn = TestUtil.request(baseURI, "/", HttpMethod.POST.name(), true); TestUtil.writeContent(urlConn, requestValue); assertEquals(200, urlConn.getResponseCode()); String content = TestUtil.getContent(urlConn); assertEquals(expectedValue, content); urlConn.disconnect(); } catch (IOException e) { TestUtil.handleException( "IOException occurred while running requestResponseCreationFromProcessorTestCase", e); } }
From source file:org.wso2.carbon.transport.http.netty.contentaware.ContentAwareMessageProcessorTestCase.java
License:Open Source License
@Test public void requestResponseStreamingFromProcessorTestCase() { String requestValue = "<A><B><C>Test Message</C></B></A>"; try {/*from w w w. jav a 2 s . c o m*/ httpConnectorListener = new RequestResponseCreationStreamingListener(configuration); TestUtil.updateMessageProcessor(httpConnectorListener); HttpURLConnection urlConn = TestUtil.request(baseURI, "/", HttpMethod.POST.name(), true); TestUtil.writeContent(urlConn, requestValue); assertEquals(200, urlConn.getResponseCode()); String content = TestUtil.getContent(urlConn); assertEquals(requestValue, content); urlConn.disconnect(); } catch (IOException e) { TestUtil.handleException( "IOException occurred while running requestResponseStreamingFromProcessorTestCase", e); } }
From source file:org.wso2.carbon.transport.http.netty.contentaware.ContentAwareMessageProcessorTestCase.java
License:Open Source License
@Test public void requestResponseTransformStreamingFromProcessorTestCase() { String requestValue = "<A><B><C>Test Message</C></B></A>"; try {/*from w w w . java 2 s . c om*/ httpConnectorListener = new RequestResponseTransformStreamingListener(configuration); TestUtil.updateMessageProcessor(httpConnectorListener); HttpURLConnection urlConn = TestUtil.request(baseURI, "/", HttpMethod.POST.name(), true); TestUtil.writeContent(urlConn, requestValue); assertEquals(200, urlConn.getResponseCode()); String content = TestUtil.getContent(urlConn); assertEquals(requestValue, content); urlConn.disconnect(); } catch (IOException e) { TestUtil.handleException( "IOException occurred while running requestResponseTransformStreamingFromProcessorTestCase", e); } }
From source file:org.wso2.carbon.transport.http.netty.contentaware.ContentAwareMessageProcessorTestCase.java
License:Open Source License
@Test public void responseStreamingWithoutBufferingTestCase() { String requestValue = "<A><B><C>Test Message</C></B></A>"; try {/*from w ww. jav a 2 s. co m*/ httpConnectorListener = new ResponseStreamingWithoutBufferingListener(); TestUtil.updateMessageProcessor(httpConnectorListener); HttpURLConnection urlConn = TestUtil.request(baseURI, "/", HttpMethod.POST.name(), true); urlConn.setChunkedStreamingMode(-1); // Enable Chunking TestUtil.writeContent(urlConn, requestValue); assertEquals(200, urlConn.getResponseCode()); String content = TestUtil.getContent(urlConn); assertEquals(requestValue, content); urlConn.disconnect(); } catch (IOException e) { TestUtil.handleException("IOException occurred while running responseStreamingWithoutBufferingTestCase", e); } }
From source file:org.wso2.carbon.transport.http.netty.contentaware.test.ContentAwareMessageProcessorTestCase.java
License:Open Source License
@Test(groups = "contentaware", dependsOnGroups = "passthroughPost") public void messageEchoingFromProcessorTestCase() { String testValue = "Test Message"; try {// ww w . ja v a 2 s.c o m HttpURLConnection urlConn = TestUtil.request(baseURI, "/", HttpMethod.POST.name(), true); TestUtil.writeContent(urlConn, testValue); assertEquals(200, urlConn.getResponseCode()); String content = TestUtil.getContent(urlConn); assertEquals(testValue, content); urlConn.disconnect(); } catch (IOException e) { LOGGER.error("IO Exception occurred", e); assertTrue(false); } }
From source file:org.wso2.carbon.transport.http.netty.contentaware.test.ContentAwareMessageProcessorTestCase.java
License:Open Source License
@Test(groups = "contentaware", dependsOnMethods = "messageEchoingFromProcessorTestCase") public void requestResponseTransformFromProcessorTestCase() { String requestValue = "XXXXXXXX"; String responseValue = "YYYYYYY"; String expectedValue = responseValue + ":" + requestValue; try {/*ww w . j a va 2s . c o m*/ CarbonMessageProcessor carbonMessageProcessor = new RequestResponseTransformProcessor(responseValue); TestUtil.updateMessageProcessor(carbonMessageProcessor, senderConfiguration, listenerConfiguration); HttpURLConnection urlConn = TestUtil.request(baseURI, "/", HttpMethod.POST.name(), true); TestUtil.writeContent(urlConn, requestValue); assertEquals(200, urlConn.getResponseCode()); String content = TestUtil.getContent(urlConn); assertEquals(expectedValue, content); urlConn.disconnect(); } catch (IOException e) { LOGGER.error("IO Exception occurred", e); assertTrue(false); } }
From source file:org.wso2.carbon.transport.http.netty.contentaware.test.ContentAwareMessageProcessorTestCase.java
License:Open Source License
@Test(groups = "contentaware", dependsOnMethods = "requestResponseTransformFromProcessorTestCase") public void requestResponseCreationFromProcessorTestCase() { String requestValue = "XXXXXXXX"; String responseValue = "YYYYYYY"; String expectedValue = responseValue + ":" + requestValue; try {/*from ww w . j a va 2 s . com*/ CarbonMessageProcessor carbonMessageProcessor = new RequestResponseCreationProcessor(responseValue); TestUtil.updateMessageProcessor(carbonMessageProcessor, senderConfiguration, listenerConfiguration); HttpURLConnection urlConn = TestUtil.request(baseURI, "/", HttpMethod.POST.name(), true); TestUtil.writeContent(urlConn, requestValue); assertEquals(200, urlConn.getResponseCode()); String content = TestUtil.getContent(urlConn); assertEquals(expectedValue, content); urlConn.disconnect(); } catch (IOException e) { LOGGER.error("IO Exception occurred", e); assertTrue(false); } }
From source file:org.wso2.carbon.transport.http.netty.contentaware.test.ContentAwareMessageProcessorTestCase.java
License:Open Source License
@Test(groups = "contentaware", dependsOnMethods = "requestResponseCreationFromProcessorTestCase") public void requestResponseStreamingFromProcessorTestCase() { String requestValue = "<A><B><C>Test Message</C></B></A>"; try {/* ww w . j a va 2s . c om*/ CarbonMessageProcessor carbonMessageProcessor = new RequestResponseCreationStreamingProcessor(); TestUtil.updateMessageProcessor(carbonMessageProcessor, senderConfiguration, listenerConfiguration); HttpURLConnection urlConn = TestUtil.request(baseURI, "/", HttpMethod.POST.name(), true); TestUtil.writeContent(urlConn, requestValue); assertEquals(200, urlConn.getResponseCode()); String content = TestUtil.getContent(urlConn); assertEquals(requestValue, content); urlConn.disconnect(); } catch (IOException e) { LOGGER.error("IO Exception occurred", e); assertTrue(false); } }