# Interface ZooKeeperServerEmbedded

All Superinterfaces:
  `AutoCloseable`

@Public @Evolving public interface ZooKeeperServerEmbedded extends AutoCloseable
This API allows you to start a ZooKeeper server node from Java code

The server will run inside the same process.

Typical usecases are:

- Running automated tests
- Launch ZooKeeper server with a Java based service management system

Please take into consideration that in production usually it is better to not run the client together with the server in order to avoid race conditions, especially around how ephemeral nodes work.

## Nested Class Summary

Nested Classes
Modifier and Type
Interface
Description
`static class`
`ZooKeeperServerEmbedded.ZookKeeperServerEmbeddedBuilder`
Builder for ZooKeeperServerEmbedded.

## Method Summary

Modifier and Type
Method
Description
`static ZooKeeperServerEmbedded.ZookKeeperServerEmbeddedBuilder`
`builder()`
`void`
`close()`
Shutdown gracefully the server and wait for resources to be released.
`int`
`getClientPort()`
Get client port for no secure connection.
`String`
`getConnectionString()`
Get a connection string useful for the client.
`int`
`getSecureClientPort()`
Get client port for secure connection.
`String`
`getSecureConnectionString()`
`void`
`start()`
Start the server.
`void`
`start(long startupTimeout)`
Start the server

## Method Details

### builder

static ZooKeeperServerEmbedded.ZookKeeperServerEmbeddedBuilder builder()

### start

void start() throws Exception
Start the server.

Throws:
  `Exception`

### start

void start(long startupTimeout) throws Exception
Start the server

Parameters:
  `startupTimeout` - time to wait in millis for the server to start
Throws:
  `Exception`

### getClientPort

int getClientPort()
Get client port for no secure connection.

### getSecureClientPort

int getSecureClientPort()
Get client port for secure connection.

### getConnectionString

String getConnectionString() throws Exception
Get a connection string useful for the client.

Returns:
  the connection string
Throws:
  `Exception` - in case the connection string is not available

### getSecureConnectionString

String getSecureConnectionString() throws Exception

Throws:
  `Exception`

### close

void close()
Shutdown gracefully the server and wait for resources to be released.

Specified by:
  `close` in interface `AutoCloseable`