Search in sources :

Example 1 with SecureSocketConnection

use of org.neo4j.bolt.v1.transport.socket.client.SecureSocketConnection 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());
}
Also used : SecureSocketConnection(org.neo4j.bolt.v1.transport.socket.client.SecureSocketConnection) SecureWebSocketConnection(org.neo4j.bolt.v1.transport.socket.client.SecureWebSocketConnection) SecureWebSocketConnection(org.neo4j.bolt.v1.transport.socket.client.SecureWebSocketConnection) WebSocketConnection(org.neo4j.bolt.v1.transport.socket.client.WebSocketConnection) SocketConnection(org.neo4j.bolt.v1.transport.socket.client.SocketConnection) SecureWebSocketConnection(org.neo4j.bolt.v1.transport.socket.client.SecureWebSocketConnection) SecureSocketConnection(org.neo4j.bolt.v1.transport.socket.client.SecureSocketConnection) WebSocketConnection(org.neo4j.bolt.v1.transport.socket.client.WebSocketConnection) HostnamePort(org.neo4j.helpers.HostnamePort) Test(org.junit.Test)

Example 2 with SecureSocketConnection

use of org.neo4j.bolt.v1.transport.socket.client.SecureSocketConnection in project neo4j by neo4j.

the class CertificatesIT method shouldUseConfiguredCertificate.

@Test
public void shouldUseConfiguredCertificate() throws Exception {
    // GIVEN
    SecureSocketConnection connection = new SecureSocketConnection();
    // WHEN
    connection.connect(new HostnamePort("localhost:7687")).send(TransportTestUtil.acceptedVersions(1, 0, 0, 0));
    // THEN
    Set<X509Certificate> certificatesSeen = connection.getServerCertificatesSeen();
    assertThat(certificatesSeen, contains(loadCertificateFromDisk()));
}
Also used : SecureSocketConnection(org.neo4j.bolt.v1.transport.socket.client.SecureSocketConnection) HostnamePort(org.neo4j.helpers.HostnamePort) X509Certificate(java.security.cert.X509Certificate) Test(org.junit.Test)

Example 3 with SecureSocketConnection

use of org.neo4j.bolt.v1.transport.socket.client.SecureSocketConnection in project neo4j by neo4j.

the class BoltIT method assertEventuallyServerResponds.

private void assertEventuallyServerResponds(String host, int port) throws Exception {
    SecureSocketConnection conn = new SecureSocketConnection();
    conn.connect(new HostnamePort(host, port));
    conn.send(new byte[] { (byte) 0x60, (byte) 0x60, (byte) 0xB0, (byte) 0x17, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 });
    assertThat(conn.recv(4), equalTo(new byte[] { 0, 0, 0, 1 }));
}
Also used : SecureSocketConnection(org.neo4j.bolt.v1.transport.socket.client.SecureSocketConnection) HostnamePort(org.neo4j.helpers.HostnamePort)

Aggregations

SecureSocketConnection (org.neo4j.bolt.v1.transport.socket.client.SecureSocketConnection)3 HostnamePort (org.neo4j.helpers.HostnamePort)3 Test (org.junit.Test)2 X509Certificate (java.security.cert.X509Certificate)1 SecureWebSocketConnection (org.neo4j.bolt.v1.transport.socket.client.SecureWebSocketConnection)1 SocketConnection (org.neo4j.bolt.v1.transport.socket.client.SocketConnection)1 WebSocketConnection (org.neo4j.bolt.v1.transport.socket.client.WebSocketConnection)1