use of org.neo4j.configuration.helpers.SocketAddress in project neo4j by neo4j.
the class CertificatesIT method setup.
@BeforeEach
public void setup(TestInfo testInfo) throws IOException {
server.setConfigure(settings -> {
SslPolicyConfig policy = SslPolicyConfig.forScope(BOLT);
settings.put(policy.enabled, true);
settings.put(policy.public_certificate, certFile.toAbsolutePath());
settings.put(policy.private_key, keyFile.toAbsolutePath());
settings.put(BoltConnector.enabled, true);
settings.put(BoltConnector.encryption_level, OPTIONAL);
settings.put(BoltConnector.listen_address, new SocketAddress("localhost", 0));
});
server.init(testInfo);
}
use of org.neo4j.configuration.helpers.SocketAddress in project neo4j by neo4j.
the class AbstractNeoWebServer method registerHttpsAddressAfterStartup.
private void registerHttpsAddressAfterStartup() {
if (httpsEnabled) {
InetSocketAddress localHttpsAddress = webServer.getLocalHttpsAddress();
connectorPortRegister.register(HttpsConnector.NAME, localHttpsAddress);
if (httpsAdvertisedAddress.getPort() == 0) {
httpsAdvertisedAddress = new SocketAddress(localHttpsAddress.getHostString(), localHttpsAddress.getPort());
}
}
}
use of org.neo4j.configuration.helpers.SocketAddress in project neo4j by neo4j.
the class Jetty9WebServerIT method shouldBeAbleToUsePortZero.
@Test
public void shouldBeAbleToUsePortZero() throws Exception {
// Given
webServer = new Jetty9WebServer(NullLogProvider.getInstance(), Config.defaults(), NetworkConnectionTracker.NO_OP, mock(ByteBufferPool.class));
webServer.setHttpAddress(new SocketAddress("localhost", 0));
// When
webServer.start();
// Then no exception
}
use of org.neo4j.configuration.helpers.SocketAddress in project neo4j by neo4j.
the class WebContainerConfigIT method shouldPickUpAddressFromConfig.
@Test
public void shouldPickUpAddressFromConfig() throws Exception {
var nonDefaultAddress = new SocketAddress("0.0.0.0", 0);
testWebContainer = CommunityWebContainerBuilder.builder().onAddress(nonDefaultAddress).usingDataDir(folder.directory(name.getMethodName()).toAbsolutePath().toString()).build();
GraphDatabaseAPI database = testWebContainer.getDefaultDatabase();
var localHttpAddress = PortUtils.getConnectorAddress(database, "http");
assertNotEquals(HttpConnector.DEFAULT_PORT, localHttpAddress.getPort());
assertEquals(nonDefaultAddress.getHostname(), localHttpAddress.getHost());
var request = HttpRequest.newBuilder(testWebContainer.getBaseUri()).GET().build();
var response = newHttpClient().send(request, discarding());
assertThat(response.statusCode()).isEqualTo(200);
}
use of org.neo4j.configuration.helpers.SocketAddress in project neo4j-documentation by neo4j.
the class TestBackup method before.
@Before
public void before() throws IOException {
Files.createDirectories(backupDirectory);
managementService = new EnterpriseDatabaseManagementServiceBuilder(databaseDirectory).setConfig(Collections.singletonMap(OnlineBackupSettings.online_backup_listen_address, new SocketAddress("127.0.0.1", backupPort))).build();
}
Aggregations