Search in sources :

Example 11 with SOLE_CONNECTION_ENFORCEMENT_POLICY

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() }));
        }
    }
}
Also used : FrameTransport(org.apache.qpid.tests.protocol.v1_0.FrameTransport) Interaction(org.apache.qpid.tests.protocol.v1_0.Interaction) UnsignedInteger(org.apache.qpid.server.protocol.v1_0.type.UnsignedInteger) Open(org.apache.qpid.server.protocol.v1_0.type.transport.Open) Test(org.junit.Test)

Aggregations

Open (org.apache.qpid.server.protocol.v1_0.type.transport.Open)10 FrameTransport (org.apache.qpid.tests.protocol.v1_0.FrameTransport)10 Test (org.junit.Test)10 Interaction (org.apache.qpid.tests.protocol.v1_0.Interaction)9 Close (org.apache.qpid.server.protocol.v1_0.type.transport.Close)6 UnsignedInteger (org.apache.qpid.server.protocol.v1_0.type.UnsignedInteger)5 LinkedHashMap (java.util.LinkedHashMap)1 NamedAddressSpace (org.apache.qpid.server.model.NamedAddressSpace)1 Symbol (org.apache.qpid.server.protocol.v1_0.type.Symbol)1