Search in sources :

Example 11 with ActiveMQNotConnectedException

use of org.apache.activemq.artemis.api.core.ActiveMQNotConnectedException in project activemq-artemis by apache.

the class CoreClientOverOneWaySSLTest method testOneWaySSLWithGoodClientProtocol.

@Test
public void testOneWaySSLWithGoodClientProtocol() throws Exception {
    createCustomSslServer();
    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");
    ServerLocator locator = addServerLocator(ActiveMQClient.createServerLocatorWithoutHA(tc));
    ClientSessionFactory sf = null;
    try {
        sf = createSessionFactory(locator);
        Assert.assertTrue(true);
    } 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());
}
Also used : ClientMessage(org.apache.activemq.artemis.api.core.client.ClientMessage) Message(org.apache.activemq.artemis.api.core.Message) ClientSession(org.apache.activemq.artemis.api.core.client.ClientSession) ActiveMQNotConnectedException(org.apache.activemq.artemis.api.core.ActiveMQNotConnectedException) SimpleString(org.apache.activemq.artemis.api.core.SimpleString) ClientSessionFactory(org.apache.activemq.artemis.api.core.client.ClientSessionFactory) ClientMessage(org.apache.activemq.artemis.api.core.client.ClientMessage) ClientConsumer(org.apache.activemq.artemis.api.core.client.ClientConsumer) ClientProducer(org.apache.activemq.artemis.api.core.client.ClientProducer) ServerLocator(org.apache.activemq.artemis.api.core.client.ServerLocator) Test(org.junit.Test)

Example 12 with ActiveMQNotConnectedException

use of org.apache.activemq.artemis.api.core.ActiveMQNotConnectedException in project activemq-artemis by apache.

the class CoreClientOverOneWaySSLTest method testOneWaySSLWithGoodServerProtocol.

@Test
public void testOneWaySSLWithGoodServerProtocol() throws Exception {
    createCustomSslServer(null, "TLSv1");
    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);
    ServerLocator locator = addServerLocator(ActiveMQClient.createServerLocatorWithoutHA(tc));
    ClientSessionFactory sf = null;
    try {
        sf = createSessionFactory(locator);
        Assert.assertTrue(true);
    } 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());
}
Also used : ClientMessage(org.apache.activemq.artemis.api.core.client.ClientMessage) Message(org.apache.activemq.artemis.api.core.Message) ClientSession(org.apache.activemq.artemis.api.core.client.ClientSession) ActiveMQNotConnectedException(org.apache.activemq.artemis.api.core.ActiveMQNotConnectedException) SimpleString(org.apache.activemq.artemis.api.core.SimpleString) ClientSessionFactory(org.apache.activemq.artemis.api.core.client.ClientSessionFactory) ClientMessage(org.apache.activemq.artemis.api.core.client.ClientMessage) ClientConsumer(org.apache.activemq.artemis.api.core.client.ClientConsumer) ClientProducer(org.apache.activemq.artemis.api.core.client.ClientProducer) ServerLocator(org.apache.activemq.artemis.api.core.client.ServerLocator) Test(org.junit.Test)

Example 13 with ActiveMQNotConnectedException

use of org.apache.activemq.artemis.api.core.ActiveMQNotConnectedException in project activemq-artemis by apache.

the class CoreClientOverOneWaySSLTest method testPOODLE.

@Test
public // http://www.oracle.com/technetwork/topics/security/poodlecve-2014-3566-2339408.html
void testPOODLE() throws Exception {
    createCustomSslServer(null, "SSLv3");
    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, "SSLv3");
    ServerLocator locator = addServerLocator(ActiveMQClient.createServerLocatorWithoutHA(tc));
    try {
        createSessionFactory(locator);
        Assert.fail();
    } catch (ActiveMQNotConnectedException e) {
        Assert.assertTrue(true);
    }
}
Also used : ActiveMQNotConnectedException(org.apache.activemq.artemis.api.core.ActiveMQNotConnectedException) ServerLocator(org.apache.activemq.artemis.api.core.client.ServerLocator) Test(org.junit.Test)

Example 14 with ActiveMQNotConnectedException

use of org.apache.activemq.artemis.api.core.ActiveMQNotConnectedException in project activemq-artemis by apache.

the class CoreClientOverOneWaySSLTest method testOneWaySSLWithBadServerCipherSuite.

@Test
public void testOneWaySSLWithBadServerCipherSuite() throws Exception {
    createCustomSslServer("myBadCipherSuite", null);
    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);
    ServerLocator locator = addServerLocator(ActiveMQClient.createServerLocatorWithoutHA(tc));
    try {
        createSessionFactory(locator);
        Assert.fail();
    } catch (ActiveMQNotConnectedException e) {
        Assert.assertTrue(true);
    }
}
Also used : ActiveMQNotConnectedException(org.apache.activemq.artemis.api.core.ActiveMQNotConnectedException) ServerLocator(org.apache.activemq.artemis.api.core.client.ServerLocator) Test(org.junit.Test)

Example 15 with ActiveMQNotConnectedException

use of org.apache.activemq.artemis.api.core.ActiveMQNotConnectedException in project activemq-artemis by apache.

the class CoreClientOverOneWaySSLTest method testOneWaySSLWithGoodClientCipherSuite.

@Test
public void testOneWaySSLWithGoodClientCipherSuite() throws Exception {
    createCustomSslServer();
    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_CIPHER_SUITES_PROP_NAME, getSuitableCipherSuite());
    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());
}
Also used : ClientMessage(org.apache.activemq.artemis.api.core.client.ClientMessage) Message(org.apache.activemq.artemis.api.core.Message) ClientSession(org.apache.activemq.artemis.api.core.client.ClientSession) ActiveMQNotConnectedException(org.apache.activemq.artemis.api.core.ActiveMQNotConnectedException) SimpleString(org.apache.activemq.artemis.api.core.SimpleString) ClientSessionFactory(org.apache.activemq.artemis.api.core.client.ClientSessionFactory) ClientMessage(org.apache.activemq.artemis.api.core.client.ClientMessage) ClientConsumer(org.apache.activemq.artemis.api.core.client.ClientConsumer) ClientProducer(org.apache.activemq.artemis.api.core.client.ClientProducer) ServerLocator(org.apache.activemq.artemis.api.core.client.ServerLocator) Test(org.junit.Test)

Aggregations

ActiveMQNotConnectedException (org.apache.activemq.artemis.api.core.ActiveMQNotConnectedException)44 Test (org.junit.Test)38 RemotingConnection (org.apache.activemq.artemis.spi.core.protocol.RemotingConnection)20 ClientSession (org.apache.activemq.artemis.api.core.client.ClientSession)19 ServerLocator (org.apache.activemq.artemis.api.core.client.ServerLocator)19 SimpleString (org.apache.activemq.artemis.api.core.SimpleString)17 ActiveMQException (org.apache.activemq.artemis.api.core.ActiveMQException)16 ClientSessionInternal (org.apache.activemq.artemis.core.client.impl.ClientSessionInternal)16 ClientProducer (org.apache.activemq.artemis.api.core.client.ClientProducer)15 ClientConsumer (org.apache.activemq.artemis.api.core.client.ClientConsumer)14 ClientMessage (org.apache.activemq.artemis.api.core.client.ClientMessage)14 ClientSessionFactory (org.apache.activemq.artemis.api.core.client.ClientSessionFactory)11 ClientSessionFactoryInternal (org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryInternal)11 TransportConfiguration (org.apache.activemq.artemis.api.core.TransportConfiguration)6 Connection (javax.jms.Connection)5 Session (javax.jms.Session)5 CountDownLatch (java.util.concurrent.CountDownLatch)4 MessageConsumer (javax.jms.MessageConsumer)4 MessageProducer (javax.jms.MessageProducer)4 Message (org.apache.activemq.artemis.api.core.Message)4