use of com.adaptris.http.legacy.VersionedHttpsProduceConnection 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.VersionedHttpsProduceConnection 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