Search in sources :

Example 1 with ActiveMQConnectionTimedOutException

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

the class ConnectionLimitTest method testNettyConnectionLimit.

@Test
public void testNettyConnectionLimit() throws Exception {
    ServerLocator locator = createNonHALocator(true).setCallTimeout(3000);
    ClientSessionFactory clientSessionFactory = locator.createSessionFactory();
    ClientSession clientSession = addClientSession(clientSessionFactory.createSession());
    try {
        ClientSessionFactory extraClientSessionFactory = locator.createSessionFactory();
        ClientSession extraClientSession = addClientSession(extraClientSessionFactory.createSession());
        fail("creating a session here should fail");
    } catch (Exception e) {
        assertTrue(e instanceof ActiveMQConnectionTimedOutException);
    }
}
Also used : ClientSession(org.apache.activemq.artemis.api.core.client.ClientSession) ActiveMQConnectionTimedOutException(org.apache.activemq.artemis.api.core.ActiveMQConnectionTimedOutException) ClientSessionFactory(org.apache.activemq.artemis.api.core.client.ClientSessionFactory) ServerLocator(org.apache.activemq.artemis.api.core.client.ServerLocator) ActiveMQConnectionTimedOutException(org.apache.activemq.artemis.api.core.ActiveMQConnectionTimedOutException) ActiveMQNotConnectedException(org.apache.activemq.artemis.api.core.ActiveMQNotConnectedException) Test(org.junit.Test)

Example 2 with ActiveMQConnectionTimedOutException

use of org.apache.activemq.artemis.api.core.ActiveMQConnectionTimedOutException 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());
    }
}
Also used : ActiveMQException(org.apache.activemq.artemis.api.core.ActiveMQException) ActiveMQConnectionTimedOutException(org.apache.activemq.artemis.api.core.ActiveMQConnectionTimedOutException) ActiveMQNotConnectedException(org.apache.activemq.artemis.api.core.ActiveMQNotConnectedException) ServerLocator(org.apache.activemq.artemis.api.core.client.ServerLocator) Test(org.junit.Test)

Aggregations

ActiveMQConnectionTimedOutException (org.apache.activemq.artemis.api.core.ActiveMQConnectionTimedOutException)2 ActiveMQNotConnectedException (org.apache.activemq.artemis.api.core.ActiveMQNotConnectedException)2 ServerLocator (org.apache.activemq.artemis.api.core.client.ServerLocator)2 Test (org.junit.Test)2 ActiveMQException (org.apache.activemq.artemis.api.core.ActiveMQException)1 ClientSession (org.apache.activemq.artemis.api.core.client.ClientSession)1 ClientSessionFactory (org.apache.activemq.artemis.api.core.client.ClientSessionFactory)1