Search in sources :

Example 1 with ProbeResult

use of io.crate.test.utils.ConnectionTest.ProbeResult in project crate by crate.

the class SSLTransportITest method test_nodes_connect_with_ssl.

@Test
public void test_nodes_connect_with_ssl() throws Exception {
    execute("select count(*) from sys.nodes");
    assertThat(response.rows()[0][0], is(2L));
    SslContextProvider sslContextProvider = new SslContextProvider(sslSettings);
    SSLContext sslContext = sslContextProvider.jdkSSLContext();
    for (var transport : internalCluster().getInstances(Transport.class)) {
        var publishAddress = transport.boundAddress().publishAddress();
        var address = publishAddress.address();
        ProbeResult probeResult = ConnectionTest.probeSSL(sslContext, address);
        assertThat(probeResult, is(ProbeResult.SSL_AVAILABLE));
    }
}
Also used : SslContextProvider(io.crate.protocols.ssl.SslContextProvider) SSLContext(javax.net.ssl.SSLContext) ProbeResult(io.crate.test.utils.ConnectionTest.ProbeResult) Test(org.junit.Test) ConnectionTest(io.crate.test.utils.ConnectionTest)

Example 2 with ProbeResult

use of io.crate.test.utils.ConnectionTest.ProbeResult in project crate by crate.

the class DefaultTransportITest method test_nodes_connect_with_hba_enabled_and_default_transport_mode.

@Test
public void test_nodes_connect_with_hba_enabled_and_default_transport_mode() throws Exception {
    execute("select count(*) from sys.nodes");
    assertThat(response.rows()[0][0], is(2L));
    SslContextProvider sslContextProvider = new SslContextProvider(sslSettings);
    SSLContext sslContext = sslContextProvider.jdkSSLContext();
    for (var transport : internalCluster().getInstances(Transport.class)) {
        var publishAddress = transport.boundAddress().publishAddress();
        var address = publishAddress.address();
        ProbeResult probeResult = ConnectionTest.probeSSL(sslContext, address);
        assertThat(probeResult, is(ProbeResult.SSL_MISSING));
    }
}
Also used : SslContextProvider(io.crate.protocols.ssl.SslContextProvider) SSLContext(javax.net.ssl.SSLContext) ProbeResult(io.crate.test.utils.ConnectionTest.ProbeResult) Test(org.junit.Test) ConnectionTest(io.crate.test.utils.ConnectionTest)

Aggregations

SslContextProvider (io.crate.protocols.ssl.SslContextProvider)2 ConnectionTest (io.crate.test.utils.ConnectionTest)2 ProbeResult (io.crate.test.utils.ConnectionTest.ProbeResult)2 SSLContext (javax.net.ssl.SSLContext)2 Test (org.junit.Test)2