Package io.karatelabs.core
Class MockServer.Builder
java.lang.Object
io.karatelabs.core.MockServer.Builder
- Enclosing class:
MockServer
Builder for creating MockServer instances.
-
Method Summary
Modifier and TypeMethodDescriptionSet initial arguments (variables) for the mock.Set the SSL certificate file path (PEM format).Add a parsed Feature.Add a feature file by path.featureString(String featureContent) Add a feature from inline string content.Set the SSL private key file path (PEM format).pathPrefix(String prefix) Set a path prefix to strip from incoming requests.port(int port) Set the port to listen on. 0 = dynamic port.ssl(boolean ssl) Enable SSL/TLS.sslContext(io.netty.handler.ssl.SslContext sslContext) Set a custom Netty SslContext (e.g. for mTLS with client auth).start()Start the mock server.watch(boolean watch) Enable watch mode for hot-reloading feature files when they change.
-
Method Details
-
feature
Add a feature file by path. -
feature
Add a parsed Feature. -
featureString
Add a feature from inline string content. -
port
Set the port to listen on. 0 = dynamic port. -
arg
Set initial arguments (variables) for the mock. -
pathPrefix
Set a path prefix to strip from incoming requests. -
ssl
Enable SSL/TLS. -
certPath
Set the SSL certificate file path (PEM format). -
keyPath
Set the SSL private key file path (PEM format). -
sslContext
Set a custom Netty SslContext (e.g. for mTLS with client auth). When set, certPath/keyPath are ignored. -
watch
Enable watch mode for hot-reloading feature files when they change. The server will check file modification times before each request and reload features if any have changed.Note: Watch mode only works for file-based features, not classpath resources in JARs.
-
start
Start the mock server.
-