use of org.apache.qpid.server.protocol.v0_8.transport in project qpid-broker-j by apache.
the class ExchangeTest method exchangeDeclareInvalidWireArguments.
@Test
public void exchangeDeclareInvalidWireArguments() throws Exception {
try (FrameTransport transport = new FrameTransport(getBrokerAdmin()).connect()) {
final Interaction interaction = transport.newInteraction();
ConnectionCloseBody response = interaction.negotiateOpen().channel().open().consumeResponse(ChannelOpenOkBody.class).exchange().declareName(TEST_EXCHANGE).declareArguments(Collections.singletonMap("foo", "bar")).declare().consumeResponse(ConnectionCloseBody.class).getLatestResponse(ConnectionCloseBody.class);
assertThat(response.getReplyCode(), is(equalTo(ErrorCodes.INVALID_ARGUMENT)));
}
}
use of org.apache.qpid.server.protocol.v0_8.transport in project qpid-broker-j by apache.
the class ExchangeTest method exchangeDeclareWithAlternateExchange.
/**
* Qpid specific extension
*/
@Test
public void exchangeDeclareWithAlternateExchange() throws Exception {
try (FrameTransport transport = new FrameTransport(getBrokerAdmin()).connect()) {
final String altExchName = "altExchange";
final Interaction interaction = transport.newInteraction();
interaction.negotiateOpen().channel().open().consumeResponse(ChannelOpenOkBody.class).exchange().declareName(altExchName).declare().consumeResponse(ExchangeDeclareOkBody.class).exchange().declareName(TEST_EXCHANGE).declareArguments(Collections.singletonMap("alternateExchange", altExchName)).declare().consumeResponse(ExchangeDeclareOkBody.class);
ChannelCloseBody inUseResponse = interaction.exchange().deleteExchangeName(altExchName).delete().consumeResponse().getLatestResponse(ChannelCloseBody.class);
assertThat(inUseResponse.getReplyCode(), is(equalTo(ErrorCodes.NOT_ALLOWED)));
interaction.channel().closeOk();
interaction.channel().open().consumeResponse(ChannelOpenOkBody.class).exchange().deleteExchangeName(TEST_EXCHANGE).delete().consumeResponse(ExchangeDeleteOkBody.class).exchange().deleteExchangeName(altExchName).delete().consumeResponse(ExchangeDeleteOkBody.class);
}
}
use of org.apache.qpid.server.protocol.v0_8.transport in project qpid-broker-j by apache.
the class ConnectionTest method connectionTuneOkAndOpen.
@Test
@SpecificationTest(section = "1.4.2.6", description = "negotiate connection tuning parameters")
public void connectionTuneOkAndOpen() throws Exception {
try (FrameTransport transport = new FrameTransport(getBrokerAdmin()).connect()) {
final Interaction interaction = transport.newInteraction();
ConnectionTuneBody response = interaction.authenticateConnection().getLatestResponse(ConnectionTuneBody.class);
interaction.connection().tuneOkChannelMax(response.getChannelMax()).tuneOkFrameMax(response.getFrameMax()).tuneOkHeartbeat(response.getHeartbeat()).tuneOk().connection().open().consumeResponse().getLatestResponse(ConnectionOpenOkBody.class);
}
}
use of org.apache.qpid.server.protocol.v0_8.transport in project qpid-broker-j by apache.
the class ConnectionTest method tooSmallFrameSize.
@Test
@SpecificationTest(section = "1.4.2.6", description = "[...] the minimum negotiated value for frame-max is also" + " frame-min-size [4096].")
public void tooSmallFrameSize() throws Exception {
try (FrameTransport transport = new FrameTransport(getBrokerAdmin()).connect()) {
final Interaction interaction = transport.newInteraction();
ConnectionTuneBody response = interaction.authenticateConnection().getLatestResponse(ConnectionTuneBody.class);
interaction.connection().tuneOkChannelMax(response.getChannelMax()).tuneOkFrameMax(1024).tuneOkHeartbeat(response.getHeartbeat()).tuneOk().connection().open().consumeResponse(ConnectionCloseBody.class, ChannelClosedResponse.class);
}
}
use of org.apache.qpid.server.protocol.v0_8.transport in project qpid-broker-j by apache.
the class ConnectionTest method tooLargeFrameSize.
@Test
@SpecificationTest(section = "1.4.2.6.2.", description = "If the client specifies a frame max that is higher than" + " the value provided by the server, the server MUST" + " close the connection without attempting a negotiated" + " close. The server may report the error in some fashion" + " to assist implementors.")
public void tooLargeFrameSize() throws Exception {
try (FrameTransport transport = new FrameTransport(getBrokerAdmin()).connect()) {
final Interaction interaction = transport.newInteraction();
ConnectionTuneBody response = interaction.authenticateConnection().getLatestResponse(ConnectionTuneBody.class);
interaction.connection().tuneOkChannelMax(response.getChannelMax()).tuneOkFrameMax(Long.MAX_VALUE).tuneOkHeartbeat(response.getHeartbeat()).tuneOk().connection().open().consumeResponse(ConnectionCloseBody.class, ChannelClosedResponse.class);
}
}
Aggregations