use of org.apache.qpid.server.protocol.v1_0.type.extensions.soleconn.SoleConnectionConnectionProperties.SOLE_CONNECTION_ENFORCEMENT_POLICY in project qpid-broker-j by apache.
the class RefuseConnectionPolicy method basicNegotiation.
@Test
public void basicNegotiation() throws Exception {
try (FrameTransport transport = new FrameTransport(_brokerAddress).connect()) {
final Interaction interaction = transport.newInteraction();
final Open responseOpen = interaction.negotiateProtocol().consumeResponse().openContainerId("testContainerId").openDesiredCapabilities(SOLE_CONNECTION_FOR_CONTAINER).openProperties(Collections.singletonMap(SOLE_CONNECTION_ENFORCEMENT_POLICY, REFUSE_CONNECTION)).open().consumeResponse().getLatestResponse(Open.class);
assertThat(Arrays.asList(responseOpen.getOfferedCapabilities()), hasItem(SOLE_CONNECTION_FOR_CONTAINER));
if (responseOpen.getProperties().containsKey(SOLE_CONNECTION_DETECTION_POLICY)) {
assertThat(responseOpen.getProperties().get(SOLE_CONNECTION_DETECTION_POLICY), isIn(new UnsignedInteger[] { SoleConnectionDetectionPolicy.STRONG.getValue(), SoleConnectionDetectionPolicy.WEAK.getValue() }));
}
}
}
Aggregations