use of org.apache.qpid.server.protocol.v1_0.type.transport.Close in project qpid-broker-j by apache.
the class OpenTest method emptyOpen.
@Test
@SpecificationTest(section = "1.3.4", description = "Open without mandatory fields should result in a decoding error.")
public void emptyOpen() throws Exception {
final InetSocketAddress addr = getBrokerAdmin().getBrokerAddress(BrokerAdmin.PortType.ANONYMOUS_AMQP);
try (FrameTransport transport = new FrameTransport(addr).connect()) {
final Interaction interaction = transport.newInteraction();
Open responseOpen = interaction.negotiateProtocol().consumeResponse().openContainerId(null).open().consumeResponse().getLatestResponse(Open.class);
assertThat(responseOpen.getContainerId(), is(notNullValue()));
Close responseClose = interaction.consumeResponse().getLatestResponse(Close.class);
assertThat(responseClose.getError(), is(notNullValue()));
assertThat(responseClose.getError().getCondition(), equalTo(AmqpError.DECODE_ERROR));
}
}
use of org.apache.qpid.server.protocol.v1_0.type.transport.Close in project qpid-broker-j by apache.
the class FlowTest method emptyFlow.
@Test
@SpecificationTest(section = "1.3.4", description = "Flow without mandatory fields should result in a decoding error.")
public void emptyFlow() throws Exception {
getBrokerAdmin().createQueue(BrokerAdmin.TEST_QUEUE_NAME);
final InetSocketAddress addr = getBrokerAdmin().getBrokerAddress(BrokerAdmin.PortType.ANONYMOUS_AMQP);
try (FrameTransport transport = new FrameTransport(addr).connect()) {
Close responseClose = transport.newInteraction().negotiateProtocol().consumeResponse().open().consumeResponse(Open.class).begin().consumeResponse(Begin.class).flowIncomingWindow(null).flowNextIncomingId(null).flowOutgoingWindow(null).flowNextOutgoingId(null).flow().consumeResponse().getLatestResponse(Close.class);
assertThat(responseClose.getError(), is(notNullValue()));
assertThat(responseClose.getError().getCondition(), is(AmqpError.DECODE_ERROR));
}
}
use of org.apache.qpid.server.protocol.v1_0.type.transport.Close in project qpid-broker-j by apache.
the class SaslTest method unsupportedSaslMechanism.
@Test
@SpecificationTest(section = "5.3.2", description = "The partner MUST then choose one of the supported mechanisms and initiate a sasl exchange." + "If the selected mechanism is not supported by the receiving peer, it MUST close the connection " + "with the authentication-failure close-code.")
public void unsupportedSaslMechanism() throws Exception {
final InetSocketAddress addr = getBrokerAdmin().getBrokerAddress(BrokerAdmin.PortType.AMQP);
try (FrameTransport transport = new FrameTransport(addr, true).connect()) {
final Interaction interaction = transport.newInteraction();
final byte[] saslHeaderResponse = interaction.protocolHeader(SASL_AMQP_HEADER_BYTES).negotiateProtocol().consumeResponse().getLatestResponse(byte[].class);
assertThat(saslHeaderResponse, is(equalTo(SASL_AMQP_HEADER_BYTES)));
interaction.consumeResponse(SaslMechanisms.class);
SaslOutcome saslOutcome = interaction.saslMechanism(Symbol.getSymbol("NOT-A-MECHANISM")).saslInit().consumeResponse().getLatestResponse(SaslOutcome.class);
assertThat(saslOutcome.getCode(), equalTo(SaslCode.AUTH));
assertThat(saslOutcome.getAdditionalData(), is(nullValue()));
transport.assertNoMoreResponsesAndChannelClosed();
}
}
use of org.apache.qpid.server.protocol.v1_0.type.transport.Close in project qpid-broker-j by apache.
the class BeginTest method channelMax.
@Test
@SpecificationTest(section = "2.7.1", description = "A peer that receives a channel number outside the supported range MUST close " + "the connection with the framing-error error-code..")
public void channelMax() throws Exception {
final InetSocketAddress addr = getBrokerAdmin().getBrokerAddress(BrokerAdmin.PortType.ANONYMOUS_AMQP);
try (FrameTransport transport = new FrameTransport(addr).connect()) {
Close responseClose = transport.newInteraction().negotiateProtocol().consumeResponse().openChannelMax(UnsignedShort.valueOf(5)).open().consumeResponse(Open.class).sessionChannel(UnsignedShort.valueOf(6)).begin().consumeResponse().getLatestResponse(Close.class);
assertThat(responseClose.getError(), is(notNullValue()));
assertThat(responseClose.getError().getCondition(), equalTo(ConnectionError.FRAMING_ERROR));
}
}
Aggregations