use of org.neo4j.bolt.testing.client.SocketConnection in project neo4j by neo4j.
the class MultipleBoltServerPortsStressTest method executeStressTest.
private static void executeStressTest(ExecutorService executorPool, HostnamePort external, HostnamePort internal) throws Exception {
long finishTimeMillis = System.currentTimeMillis() + MINUTES.toMillis(MultipleBoltServerPortsStressTest.DURATION_IN_MINUTES);
AtomicBoolean failureFlag = new AtomicBoolean(false);
for (int i = 0; i < MultipleBoltServerPortsStressTest.NUMBER_OF_THREADS; i++) {
SocketConnection connection = new SocketConnection();
// split connections evenly between internal and external
if (i % 2 == 0) {
initializeConnection(connection, internal);
} else {
initializeConnection(connection, external);
}
executorPool.submit(workload(failureFlag, connection, finishTimeMillis));
}
executorPool.shutdown();
executorPool.awaitTermination(DURATION_IN_MINUTES, MINUTES);
assertThat(failureFlag).isFalse();
}
use of org.neo4j.bolt.testing.client.SocketConnection in project neo4j by neo4j.
the class BoltIT method assertEventuallyServerResponds.
private void assertEventuallyServerResponds(String host, int port) throws Exception {
SocketConnection conn = new SocketConnection();
conn.connect(new HostnamePort(host, port));
conn.send(new byte[] { (byte) 0x60, (byte) 0x60, (byte) 0xB0, (byte) 0x17, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 });
assertThat(conn.recv(4)).isEqualTo(new byte[] { 0, 0, 0, 4 });
}
Aggregations