use of com.adaptris.http.legacy.SimpleHttpProducer in project interlok by adaptris.
the class HttpConsumerTest method createProducer.
protected SimpleHttpProducer createProducer() {
SimpleHttpProducer p = new SimpleHttpProducer();
p.registerConnection(new HttpProduceConnection());
p.setContentTypeKey("content.type");
p.setIgnoreServerResponseCode(true);
return p;
}
use of com.adaptris.http.legacy.SimpleHttpProducer in project interlok by adaptris.
the class HttpsConsumerTest method createProducer.
private SimpleHttpProducer createProducer(HttpsProduceConnection https) {
SimpleHttpProducer p = new SimpleHttpProducer();
https.setKeystore(PROPERTIES.getProperty(JunitSecurityHelper.KEYSTORE_URL));
https.setAlwaysTrust(true);
https.setPrivateKeyPasswordProvider(new ConfiguredPrivateKeyPasswordProvider(PROPERTIES.getProperty(JunitSecurityHelper.SECURITY_PASSWORD)));
https.setKeystorePassword(PROPERTIES.getProperty(JunitSecurityHelper.SECURITY_PASSWORD));
p.registerConnection(https);
p.setContentTypeKey("content.type");
p.setIgnoreServerResponseCode(true);
return p;
}
use of com.adaptris.http.legacy.SimpleHttpProducer in project interlok by adaptris.
the class HttpsConsumerTest method testTLS_ConsumeWorkflow.
@Test
public void testTLS_ConsumeWorkflow() throws Exception {
String oldName = Thread.currentThread().getName();
Thread.currentThread().setName(getName());
HttpConnection connection = createConnection(null);
((HttpsConnection) connection).getSslProperties().add(new KeyValuePair(SslProperty.ExcludeProtocols.name(), "SSLv3,TLSv1.1,"));
MockMessageProducer mockProducer = new MockMessageProducer();
SimpleHttpProducer myHttpProducer = createProducer(new VersionedHttpsProduceConnection("TLSv1.2"));
Channel channel = JettyHelper.createChannel(connection, JettyHelper.createConsumer(URL_TO_POST_TO), mockProducer);
try {
channel.requestStart();
AdaptrisMessage msg = AdaptrisMessageFactory.getDefaultInstance().newMessage(XML_PAYLOAD);
msg.addMetadata(CONTENT_TYPE_METADATA_KEY, "text/xml");
myHttpProducer.setUrl(createProduceDestinationUrl(connection.getPort()));
start(myHttpProducer);
AdaptrisMessage reply = myHttpProducer.request(msg);
assertEquals("Reply Payloads", XML_PAYLOAD, reply.getContent());
doAssertions(mockProducer);
} finally {
stop(myHttpProducer);
channel.requestClose();
PortManager.release(connection.getPort());
Thread.currentThread().setName(oldName);
}
}
use of com.adaptris.http.legacy.SimpleHttpProducer in project interlok by adaptris.
the class HttpsConsumerTest method testTLS_ConsumeWorkflow_ClientUsesSSL.
@Test
public void testTLS_ConsumeWorkflow_ClientUsesSSL() throws Exception {
String oldName = Thread.currentThread().getName();
Thread.currentThread().setName(getName());
HttpConnection connection = createConnection(null);
((HttpsConnection) connection).getSslProperties().add(new KeyValuePair(SslProperty.ExcludeProtocols.name(), "SSLv3"));
MockMessageProducer mockProducer = new MockMessageProducer();
SimpleHttpProducer myHttpProducer = createProducer(new VersionedHttpsProduceConnection("SSLv3"));
Channel channel = JettyHelper.createChannel(connection, JettyHelper.createConsumer(URL_TO_POST_TO), mockProducer);
try {
channel.requestStart();
AdaptrisMessage msg = AdaptrisMessageFactory.getDefaultInstance().newMessage(XML_PAYLOAD);
msg.addMetadata(CONTENT_TYPE_METADATA_KEY, "text/xml");
myHttpProducer.setUrl(createProduceDestinationUrl(connection.getPort()));
start(myHttpProducer);
AdaptrisMessage reply = myHttpProducer.request(msg);
// SSLv3 context shouldn't be allowed to connect to TLSv1.2 only
fail();
} catch (CoreException expected) {
} finally {
stop(myHttpProducer);
channel.requestClose();
PortManager.release(connection.getPort());
Thread.currentThread().setName(oldName);
}
}
Aggregations