use of org.apache.activemq.artemis.api.core.ActiveMQNotConnectedException in project activemq-artemis by apache.
the class NettyConnectorWithHTTPUpgradeTest method HTTPUpgradeConnectorUsingNormalAcceptor.
@Test
public void HTTPUpgradeConnectorUsingNormalAcceptor() throws Exception {
HashMap<String, Object> params = new HashMap<>();
// create a new locator that points an HTTP-upgrade connector to the normal acceptor
params.put(TransportConstants.HTTP_UPGRADE_ENABLED_PROP_NAME, true);
long start = System.currentTimeMillis();
locator = ActiveMQClient.createServerLocatorWithoutHA(new TransportConfiguration(NETTY_CONNECTOR_FACTORY, params));
Exception e = null;
try {
createSessionFactory(locator);
// we shouldn't ever get here
fail();
} catch (Exception x) {
e = x;
}
// make sure we failed *before* the HTTP hand-shake timeout elapsed (which is hard-coded to 30 seconds, see org.apache.activemq.artemis.core.remoting.impl.netty.NettyConnector.HttpUpgradeHandler.awaitHandshake())
assertTrue((System.currentTimeMillis() - start) < 30000);
assertNotNull(e);
assertTrue(e instanceof ActiveMQNotConnectedException);
assertTrue(((ActiveMQException) e).getType() == ActiveMQExceptionType.NOT_CONNECTED);
}
use of org.apache.activemq.artemis.api.core.ActiveMQNotConnectedException in project activemq-artemis by apache.
the class CoreClientOverOneWaySSLTest method testOneWaySSLWithoutTrustStore.
@Test
public void testOneWaySSLWithoutTrustStore() throws Exception {
createCustomSslServer();
tc.getParams().put(TransportConstants.SSL_ENABLED_PROP_NAME, true);
ServerLocator locator = addServerLocator(ActiveMQClient.createServerLocatorWithoutHA(tc));
try {
createSessionFactory(locator);
Assert.fail();
} catch (ActiveMQNotConnectedException se) {
// 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 testOneWaySSLWithIncorrectTrustStorePath.
@Test
public void testOneWaySSLWithIncorrectTrustStorePath() throws Exception {
createCustomSslServer();
tc.getParams().put(TransportConstants.SSL_ENABLED_PROP_NAME, true);
tc.getParams().put(TransportConstants.TRUSTSTORE_PATH_PROP_NAME, "incorrect path");
tc.getParams().put(TransportConstants.TRUSTSTORE_PASSWORD_PROP_NAME, PASSWORD);
ServerLocator locator = addServerLocator(ActiveMQClient.createServerLocatorWithoutHA(tc));
try {
ClientSessionFactory sf = createSessionFactory(locator);
Assert.fail();
} catch (ActiveMQNotConnectedException se) {
// 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 testOneWaySSLWithBadClientProtocol.
@Test
public void testOneWaySSLWithBadClientProtocol() throws Exception {
createCustomSslServer();
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, "myBadProtocol");
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 testOneWaySSLWithIncorrectTrustStorePassword.
@Test
public void testOneWaySSLWithIncorrectTrustStorePassword() throws Exception {
createCustomSslServer();
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, "invalid password");
ServerLocator locator = addServerLocator(ActiveMQClient.createServerLocatorWithoutHA(tc));
try {
ClientSessionFactory sf = createSessionFactory(locator);
Assert.fail();
} catch (ActiveMQNotConnectedException se) {
// ok
} catch (ActiveMQException e) {
fail("Invalid Exception type:" + e.getType());
}
}
Aggregations