use of com.rabbitmq.client.ConnectionFactory in project rabbitmq-java-client by rabbitmq.
the class ExchangeDeclare method exchangeDeclaredWithEnumerationEquivalentOnRecoverableConnection.
@Test
public void exchangeDeclaredWithEnumerationEquivalentOnRecoverableConnection() throws IOException, TimeoutException, InterruptedException {
ConnectionFactory connectionFactory = TestUtils.connectionFactory();
connectionFactory.setAutomaticRecoveryEnabled(true);
connectionFactory.setTopologyRecoveryEnabled(false);
Connection c = connectionFactory.newConnection();
try {
doTestExchangeDeclaredWithEnumerationEquivalent(c.createChannel());
} finally {
c.abort();
}
}
use of com.rabbitmq.client.ConnectionFactory in project rabbitmq-java-client by rabbitmq.
the class FrameMax method rejectLargeFramesDuringConnectionNegotiation.
/* server should reject frames larger than AMQP.FRAME_MIN_SIZE
* during connection negotiation */
@Test
public void rejectLargeFramesDuringConnectionNegotiation() throws IOException, TimeoutException {
ConnectionFactory cf = TestUtils.connectionFactory();
cf.getClientProperties().put("too_long", LongStringHelper.asLongString(new byte[AMQP.FRAME_MIN_SIZE]));
try {
cf.newConnection();
fail("Expected exception during connection negotiation");
} catch (IOException e) {
}
}
use of com.rabbitmq.client.ConnectionFactory in project rabbitmq-java-client by rabbitmq.
the class FrameMax method rejectExceedingFrameMax.
/* server should reject frames larger than the negotiated frame
* size */
@Test
public void rejectExceedingFrameMax() throws IOException, TimeoutException {
closeChannel();
closeConnection();
ConnectionFactory cf = new GenerousConnectionFactory();
connection = cf.newConnection();
openChannel();
basicPublishVolatile(new byte[connection.getFrameMax()], "void");
expectError(AMQP.FRAME_ERROR);
}
use of com.rabbitmq.client.ConnectionFactory in project rabbitmq-java-client by rabbitmq.
the class Metrics method createConnectionFactory.
private static ConnectionFactory createConnectionFactory() {
ConnectionFactory connectionFactory = TestUtils.connectionFactory();
connectionFactory.setAutomaticRecoveryEnabled(false);
return connectionFactory;
}
use of com.rabbitmq.client.ConnectionFactory in project rabbitmq-java-client by rabbitmq.
the class SaslMechanisms method connectionWithoutCapabilities.
// start a connection without capabilities, causing authentication failures
// to be reported by the broker by closing the connection
private Connection connectionWithoutCapabilities(String username, String password) throws IOException, TimeoutException {
ConnectionFactory customFactory = TestUtils.connectionFactory();
customFactory.setUsername(username);
customFactory.setPassword(password);
Map<String, Object> customProperties = AMQConnection.defaultClientProperties();
customProperties.remove("capabilities");
customFactory.setClientProperties(customProperties);
return customFactory.newConnection();
}
Aggregations