Search in sources :

Example 1 with SocketConnection

use of org.neo4j.bolt.testing.client.SocketConnection in project neo4j by neo4j.

the class InProcessServerBuilderIT method shouldOpenBoltPort.

@Test
void shouldOpenBoltPort() {
    // given
    try (Neo4j neo4j = getTestBuilder(directory.homePath()).build()) {
        URI uri = neo4j.boltURI();
        // when
        assertDoesNotThrow(() -> new SocketConnection().connect(new HostnamePort(uri.getHost(), uri.getPort())));
    }
}
Also used : SocketConnection(org.neo4j.bolt.testing.client.SocketConnection) HostnamePort(org.neo4j.internal.helpers.HostnamePort) URI(java.net.URI) Test(org.junit.jupiter.api.Test)

Example 2 with SocketConnection

use of org.neo4j.bolt.testing.client.SocketConnection in project neo4j by neo4j.

the class MultipleBoltServerPortsStressTest method splitTrafficBetweenPorts.

@Test
void splitTrafficBetweenPorts() throws Exception {
    SocketConnection externalConnection = new SocketConnection();
    SocketConnection internalConnection = new SocketConnection();
    try {
        HostnamePort externalAddress = server.lookupConnector(BoltConnector.NAME);
        HostnamePort internalAddress = server.lookupConnector(BoltConnector.INTERNAL_NAME);
        executeStressTest(Executors.newFixedThreadPool(NUMBER_OF_THREADS), externalAddress, internalAddress);
    } finally {
        externalConnection.disconnect();
        internalConnection.disconnect();
    }
}
Also used : SocketConnection(org.neo4j.bolt.testing.client.SocketConnection) HostnamePort(org.neo4j.internal.helpers.HostnamePort) Test(org.junit.jupiter.api.Test)

Example 3 with SocketConnection

use of org.neo4j.bolt.testing.client.SocketConnection in project neo4j by neo4j.

the class BoltKeepAliveSchedulingIT method setup.

@BeforeEach
public void setup(TestInfo testInfo) throws Exception {
    server.setConfigure(getSettingsFunction());
    server.init(testInfo);
    installSleepProcedure(server.graphDatabaseService());
    address = server.lookupDefaultConnector();
    connection = new SocketConnection();
    util = new TransportTestUtil();
}
Also used : SocketConnection(org.neo4j.bolt.testing.client.SocketConnection) TransportTestUtil(org.neo4j.bolt.testing.TransportTestUtil) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 4 with SocketConnection

use of org.neo4j.bolt.testing.client.SocketConnection in project neo4j by neo4j.

the class BoltChannelAutoReadLimiterIT method setup.

@BeforeEach
public void setup(TestInfo testInfo) throws Exception {
    server.setGraphDatabaseFactory(getTestGraphDatabaseFactory());
    server.setConfigure(getSettingsFunction());
    server.init(testInfo);
    address = server.lookupDefaultConnector();
    connection = new SocketConnection();
    util = new TransportTestUtil();
    installSleepProcedure(server.graphDatabaseService());
}
Also used : SocketConnection(org.neo4j.bolt.testing.client.SocketConnection) TransportTestUtil(org.neo4j.bolt.testing.TransportTestUtil) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 5 with SocketConnection

use of org.neo4j.bolt.testing.client.SocketConnection in project neo4j by neo4j.

the class ConnectionTrackingIT method connectSocketTo.

private TransportConnection connectSocketTo(URI uri) throws IOException {
    SocketConnection connection = new SocketConnection();
    connections.add(connection);
    connection.connect(new HostnamePort(uri.getHost(), uri.getPort()));
    return connection;
}
Also used : SocketConnection(org.neo4j.bolt.testing.client.SocketConnection) HostnamePort(org.neo4j.internal.helpers.HostnamePort)

Aggregations

SocketConnection (org.neo4j.bolt.testing.client.SocketConnection)7 HostnamePort (org.neo4j.internal.helpers.HostnamePort)4 BeforeEach (org.junit.jupiter.api.BeforeEach)2 Test (org.junit.jupiter.api.Test)2 TransportTestUtil (org.neo4j.bolt.testing.TransportTestUtil)2 URI (java.net.URI)1 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)1