use of org.neo4j.bolt.v1.transport.socket.client.SocketConnection in project neo4j by neo4j.
the class BoltConfigIT method shouldSupportMultipleConnectors.
@Test
public void shouldSupportMultipleConnectors() throws Throwable {
// Given
// When
// Then
HostnamePort address0 = new HostnamePort("localhost:7888");
assertConnectionAccepted(address0, new WebSocketConnection());
assertConnectionAccepted(address0, new SecureWebSocketConnection());
assertConnectionAccepted(address0, new SocketConnection());
assertConnectionAccepted(address0, new SecureSocketConnection());
HostnamePort address1 = new HostnamePort("localhost:7687");
assertConnectionRejected(address1, new WebSocketConnection());
assertConnectionAccepted(address1, new SecureWebSocketConnection());
assertConnectionRejected(address1, new SocketConnection());
assertConnectionAccepted(address1, new SecureSocketConnection());
}
use of org.neo4j.bolt.v1.transport.socket.client.SocketConnection in project neo4j by neo4j.
the class ProcedureInteractionTestBase method startBoltSession.
@SuppressWarnings("unchecked")
TransportConnection startBoltSession(String username, String password) throws Exception {
TransportConnection connection = new SocketConnection();
HostnamePort address = new HostnamePort("localhost:7687");
Map<String, Object> authToken = map("principal", username, "credentials", password, "scheme", "basic");
connection.connect(address).send(TransportTestUtil.acceptedVersions(1, 0, 0, 0)).send(TransportTestUtil.chunk(init("TestClient/1.1", authToken)));
assertThat(connection, eventuallyReceives(new byte[] { 0, 0, 0, 1 }));
assertThat(connection, eventuallyReceives(msgSuccess()));
return connection;
}
use of org.neo4j.bolt.v1.transport.socket.client.SocketConnection in project neo4j by neo4j.
the class BoltMetricsIT method shouldMonitorBolt.
@Test
public void shouldMonitorBolt() throws Throwable {
// Given
File metricsFolder = tmpDir.newFolder("metrics");
db = (GraphDatabaseAPI) new TestGraphDatabaseFactory().newImpermanentDatabaseBuilder().setConfig(new BoltConnector("bolt").type, "BOLT").setConfig(new BoltConnector("bolt").enabled, "true").setConfig(GraphDatabaseSettings.auth_enabled, "false").setConfig(MetricsSettings.boltMessagesEnabled, "true").setConfig(MetricsSettings.csvEnabled, "true").setConfig(MetricsSettings.csvInterval, "100ms").setConfig(MetricsSettings.csvPath, metricsFolder.getAbsolutePath()).newGraphDatabase();
// When
conn = new SocketConnection().connect(new HostnamePort("localhost", 7687)).send(acceptedVersions(1, 0, 0, 0)).send(chunk(InitMessage.init("TestClient", map("scheme", "basic", "principal", "neo4j", "credentials", "neo4j"))));
// Then
assertEventually("session shows up as started", () -> readLongValue(metricsCsv(metricsFolder, SESSIONS_STARTED)), equalTo(1L), 5, SECONDS);
assertEventually("init request shows up as received", () -> readLongValue(metricsCsv(metricsFolder, MESSAGES_RECIEVED)), equalTo(1L), 5, SECONDS);
assertEventually("init request shows up as started", () -> readLongValue(metricsCsv(metricsFolder, MESSAGES_STARTED)), equalTo(1L), 5, SECONDS);
assertEventually("init request shows up as done", () -> readLongValue(metricsCsv(metricsFolder, MESSAGES_DONE)), equalTo(1L), 5, SECONDS);
assertEventually("queue time shows up", () -> readLongValue(metricsCsv(metricsFolder, TOTAL_QUEUE_TIME)), greaterThanOrEqualTo(0L), 5, SECONDS);
assertEventually("processing time shows up", () -> readLongValue(metricsCsv(metricsFolder, TOTAL_PROCESSING_TIME)), greaterThanOrEqualTo(0L), 5, SECONDS);
}
use of org.neo4j.bolt.v1.transport.socket.client.SocketConnection in project neo4j by neo4j.
the class InProcessBuilderTest method shouldOpenBoltPort.
@Test
public void shouldOpenBoltPort() throws Throwable {
// given
try (ServerControls controls = newInProcessBuilder().newServer()) {
URI uri = controls.boltURI();
// when
new SocketConnection().connect(new HostnamePort(uri.getHost(), uri.getPort()));
// then no exception
}
}
Aggregations