use of org.apache.qpid.server.protocol.v0_10.transport.ConnectionStart in project qpid-broker-j by apache.
the class ProtocolTest method versionNegotiation.
@Test
@SpecificationTest(section = "4.3. Version Negotiation", description = "When the client opens a new socket connection to an AMQP server," + " it MUST send a protocol header with the client's preferred protocol version." + "If the requested protocol version is supported, the server MUST send its own protocol" + " header with the requested version to the socket, and then implement the protocol accordingly")
public void versionNegotiation() throws Exception {
try (FrameTransport transport = new FrameTransport(_brokerAddress).connect()) {
final Interaction interaction = transport.newInteraction();
Response<?> response = interaction.negotiateProtocol().consumeResponse().getLatestResponse();
assertThat(response, is(instanceOf(HeaderResponse.class)));
assertThat(response.getBody(), is(IsEqual.equalTo(transport.getProtocolHeader())));
ConnectionStart connectionStart = interaction.consumeResponse().getLatestResponse(ConnectionStart.class);
assertThat(connectionStart.getMechanisms(), is(notNullValue()));
assertThat(connectionStart.getMechanisms(), contains(ConnectionInteraction.SASL_MECHANISM_ANONYMOUS));
assertThat(connectionStart.getLocales(), is(notNullValue()));
assertThat(connectionStart.getLocales(), contains(DEFAULT_LOCALE));
}
}
use of org.apache.qpid.server.protocol.v0_10.transport.ConnectionStart in project qpid-broker-j by apache.
the class AuthenticationTimeoutTest method authenticationTimeout.
@Test
public void authenticationTimeout() throws Exception {
InetSocketAddress brokerAddress = getBrokerAdmin().getBrokerAddress(BrokerAdmin.PortType.AMQP);
try (FrameTransport transport = new FrameTransport(brokerAddress).connect()) {
final Interaction interaction = transport.newInteraction();
final ConnectionStart start = interaction.negotiateProtocol().consumeResponse().consumeResponse().getLatestResponse(ConnectionStart.class);
assertThat(start.getMechanisms(), CoreMatchers.hasItem("PLAIN"));
transport.assertNoMoreResponsesAndChannelClosed();
}
}
Aggregations