use of org.apache.qpid.test.utils.TCPTunneler in project qpid-broker-j by apache.
the class UnifiedPortTest method doTestSlowConnect.
private void doTestSlowConnect(final boolean useTls) throws Exception {
final int port = getBrokerAdmin().getBrokerAddress(BrokerAdmin.PortType.HTTP).getPort();
try (TCPTunneler tunneler = new TCPTunneler(0, "localhost", port, 1, 2)) {
// Hopes to exercise the code path where too few bytes arrive with Jetty for it to make an PLAIN/TLS
// determination and needs to await more bytes.
tunneler.addClientListener(new PreambleDelayingListener());
tunneler.start();
HttpTestHelper _restTestHelper = new HttpTestHelper(getBrokerAdmin(), null, tunneler.getLocalPort());
_restTestHelper.setTls(useTls);
Map<String, Object> metadata = _restTestHelper.getJsonAsMap("broker/getConnectionMetaData");
String transport = String.valueOf(metadata.get("transport"));
final String expected = useTls ? "SSL" : "TCP";
assertThat("Unexpected protocol", transport, CoreMatchers.is(equalTo(expected)));
}
}
use of org.apache.qpid.test.utils.TCPTunneler in project qpid-broker-j by apache.
the class AbruptClientDisconnectTest method setUp.
@Before
public void setUp() throws Exception {
_executorService = Executors.newFixedThreadPool(3);
_utilityConnection = getConnection();
_utilityConnection.start();
// create queue
_testQueue = createQueue(getTestName());
final InetSocketAddress brokerAddress = getBrokerAdmin().getBrokerAddress(BrokerAdmin.PortType.AMQP);
_tcpTunneler = new TCPTunneler(0, brokerAddress.getHostName(), brokerAddress.getPort(), 1);
_tcpTunneler.start();
}
Aggregations