use of org.apache.activemq.artemis.api.core.ActiveMQNotConnectedException in project activemq-artemis by apache.
the class CoreClientOverOneWaySSLTest method testOneWaySSLWithGoodServerCipherSuite.
@Test
public void testOneWaySSLWithGoodServerCipherSuite() throws Exception {
createCustomSslServer(getSuitableCipherSuite(), null);
String text = RandomUtil.randomString();
tc.getParams().put(TransportConstants.SSL_ENABLED_PROP_NAME, true);
tc.getParams().put(TransportConstants.TRUSTSTORE_PROVIDER_PROP_NAME, storeType);
tc.getParams().put(TransportConstants.TRUSTSTORE_PATH_PROP_NAME, CLIENT_SIDE_TRUSTSTORE);
tc.getParams().put(TransportConstants.TRUSTSTORE_PASSWORD_PROP_NAME, PASSWORD);
tc.getParams().put(TransportConstants.ENABLED_PROTOCOLS_PROP_NAME, "TLSv1.2");
ServerLocator locator = addServerLocator(ActiveMQClient.createServerLocatorWithoutHA(tc));
ClientSessionFactory sf = null;
try {
sf = createSessionFactory(locator);
} catch (ActiveMQNotConnectedException e) {
Assert.fail();
}
ClientSession session = sf.createSession(false, true, true);
session.createQueue(CoreClientOverOneWaySSLTest.QUEUE, CoreClientOverOneWaySSLTest.QUEUE, false);
ClientProducer producer = session.createProducer(CoreClientOverOneWaySSLTest.QUEUE);
ClientMessage message = createTextMessage(session, text);
producer.send(message);
ClientConsumer consumer = session.createConsumer(CoreClientOverOneWaySSLTest.QUEUE);
session.start();
Message m = consumer.receive(1000);
Assert.assertNotNull(m);
Assert.assertEquals(text, m.getBodyBuffer().readString());
}
use of org.apache.activemq.artemis.api.core.ActiveMQNotConnectedException in project activemq-artemis by apache.
the class CoreClientOverOneWaySSLTest method testOneWaySSLWithMismatchedCipherSuites.
@Test
public void testOneWaySSLWithMismatchedCipherSuites() throws Exception {
createCustomSslServer(getEnabledCipherSuites()[0], "TLSv1.2");
tc.getParams().put(TransportConstants.SSL_ENABLED_PROP_NAME, true);
tc.getParams().put(TransportConstants.TRUSTSTORE_PROVIDER_PROP_NAME, storeType);
tc.getParams().put(TransportConstants.TRUSTSTORE_PATH_PROP_NAME, CLIENT_SIDE_TRUSTSTORE);
tc.getParams().put(TransportConstants.TRUSTSTORE_PASSWORD_PROP_NAME, PASSWORD);
tc.getParams().put(TransportConstants.ENABLED_CIPHER_SUITES_PROP_NAME, getEnabledCipherSuites()[1]);
tc.getParams().put(TransportConstants.ENABLED_PROTOCOLS_PROP_NAME, "TLSv1.2");
ServerLocator locator = addServerLocator(ActiveMQClient.createServerLocatorWithoutHA(tc));
try {
createSessionFactory(locator);
Assert.fail();
} catch (ActiveMQNotConnectedException e) {
Assert.assertTrue(true);
}
}
use of org.apache.activemq.artemis.api.core.ActiveMQNotConnectedException in project activemq-artemis by apache.
the class CoreClientOverOneWaySSLTest method testPlainConnectionToSSLEndpoint.
// see https://jira.jboss.org/jira/browse/HORNETQ-234
@Test
public void testPlainConnectionToSSLEndpoint() throws Exception {
createCustomSslServer();
tc.getParams().put(TransportConstants.SSL_ENABLED_PROP_NAME, false);
ServerLocator locator = addServerLocator(ActiveMQClient.createServerLocatorWithoutHA(tc)).setCallTimeout(2000);
try {
createSessionFactory(locator);
fail("expecting exception");
} catch (ActiveMQNotConnectedException se) {
// ok
} catch (ActiveMQConnectionTimedOutException ctoe) {
// ok
} catch (ActiveMQException e) {
fail("Invalid Exception type:" + e.getType());
}
}
use of org.apache.activemq.artemis.api.core.ActiveMQNotConnectedException in project activemq-artemis by apache.
the class CoreClientOverOneWaySSLTest method testOneWaySSLWithMismatchedProtocols.
@Test
public void testOneWaySSLWithMismatchedProtocols() throws Exception {
createCustomSslServer(null, "TLSv1");
tc.getParams().put(TransportConstants.SSL_ENABLED_PROP_NAME, true);
tc.getParams().put(TransportConstants.TRUSTSTORE_PROVIDER_PROP_NAME, storeType);
tc.getParams().put(TransportConstants.TRUSTSTORE_PATH_PROP_NAME, CLIENT_SIDE_TRUSTSTORE);
tc.getParams().put(TransportConstants.TRUSTSTORE_PASSWORD_PROP_NAME, PASSWORD);
tc.getParams().put(TransportConstants.ENABLED_PROTOCOLS_PROP_NAME, "TLSv1.2");
ServerLocator locator = addServerLocator(ActiveMQClient.createServerLocatorWithoutHA(tc));
try {
createSessionFactory(locator);
Assert.fail();
} catch (ActiveMQNotConnectedException e) {
Assert.assertTrue(true);
}
}
use of org.apache.activemq.artemis.api.core.ActiveMQNotConnectedException in project activemq-artemis by apache.
the class ReplicationTest method testConnectIntoNonBackup.
@Test
public void testConnectIntoNonBackup() throws Exception {
setupServer(false);
try {
ClientSessionFactory sf = createSessionFactory(locator);
manager = new ReplicationManager((CoreRemotingConnection) sf.getConnection(), sf.getServerLocator().getCallTimeout(), sf.getServerLocator().getCallTimeout(), factory);
addActiveMQComponent(manager);
manager.start();
Assert.fail("Exception was expected");
} catch (ActiveMQNotConnectedException nce) {
// ok
} catch (ActiveMQException expected) {
fail("Invalid Exception type:" + expected.getType());
}
}
Aggregations