use of org.apache.activemq.artemis.tests.integration.stomp.util.StompClientConnectionV11 in project activemq-artemis by apache.
the class StompV12Test method testConnection.
@Test
public void testConnection() throws Exception {
server.getActiveMQServer().getConfiguration().setSecurityEnabled(true);
StompClientConnection connection = StompClientConnectionFactory.createClientConnection(v10Uri);
connection.connect(defUser, defPass);
Assert.assertTrue(connection.isConnected());
Assert.assertEquals("1.0", connection.getVersion());
connection.disconnect();
connection = StompClientConnectionFactory.createClientConnection(uri);
connection.connect(defUser, defPass);
Assert.assertTrue(connection.isConnected());
Assert.assertEquals("1.2", connection.getVersion());
connection.disconnect();
connection = StompClientConnectionFactory.createClientConnection(uri);
connection.connect();
Assert.assertFalse(connection.isConnected());
// new way of connection
StompClientConnectionV11 conn = (StompClientConnectionV11) StompClientConnectionFactory.createClientConnection(v11Uri);
conn.connect1(defUser, defPass);
Assert.assertTrue(conn.isConnected());
conn.disconnect();
}
use of org.apache.activemq.artemis.tests.integration.stomp.util.StompClientConnectionV11 in project activemq-artemis by apache.
the class StompV11Test method testConnection.
@Test
public void testConnection() throws Exception {
server.getActiveMQServer().getConfiguration().setSecurityEnabled(true);
StompClientConnection connection = StompClientConnectionFactory.createClientConnection(v10Uri);
connection.connect(defUser, defPass);
assertTrue(connection.isConnected());
assertEquals("1.0", connection.getVersion());
connection.disconnect();
connection = StompClientConnectionFactory.createClientConnection(uri);
connection.connect(defUser, defPass);
assertTrue(connection.isConnected());
assertEquals("1.1", connection.getVersion());
connection.disconnect();
connection = StompClientConnectionFactory.createClientConnection(uri);
connection.connect();
assertFalse(connection.isConnected());
// new way of connection
StompClientConnectionV11 conn = (StompClientConnectionV11) StompClientConnectionFactory.createClientConnection(uri);
conn.connect1(defUser, defPass);
assertTrue(conn.isConnected());
conn.disconnect();
// invalid user
conn = (StompClientConnectionV11) StompClientConnectionFactory.createClientConnection(uri);
ClientStompFrame frame = conn.connect("invaliduser", defPass);
assertFalse(conn.isConnected());
assertTrue(Stomp.Responses.ERROR.equals(frame.getCommand()));
assertTrue(frame.getBody().contains("Security Error occurred"));
}
Aggregations