Package com.ngrok
Class Session.Builder
- java.lang.Object
-
- com.ngrok.Session.Builder
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Session.BuilderaddClientInfo(String name, String version)Adds a client info to the list of client info objects for this builderSession.BuilderaddClientInfo(String name, String version, String comments)Adds a client info to the list of client info objects for this builderSession.BuildercaCert(byte[] data)Sets the ca certificate for this builderSessionconnect()Connects a session with the currentSession.BuilderStringgetAuthtoken()Returns the ngrok authtoken associated with this builder.byte[]getCaCert()Returns the certificate for this builder.List<Session.ClientInfo>getClientInfos()Returns the list of client info objects to add for this builderOptional<Duration>getHeartbeatInterval()Returns the heartbeat interval for this builderOptional<Duration>getHeartbeatTolerance()Returns the heartbeat tolerance for this builderOptional<String>getMetadata()Returns the metadata for this builder.Optional<String>getServerAddr()Returns the server address for this builder.Session.HeartbeatHandlerheartbeatHandler()Returns the heartbeat handler for this builder.Session.BuilderheartbeatHandler(Session.HeartbeatHandler heartbeatHandler)Sets the heartbeat handler for this builderSession.BuilderheartbeatInterval(Duration duration)Sets the heartbeat interval for this builderSession.BuilderheartbeatTolerance(Duration duration)Sets the heartbeat tolerance for this builderSession.Buildermetadata(String metadata)Sets the metadata for this builderSession.CommandHandlerrestartCallback()Returns the restart callback handler for this builder.Session.BuilderrestartCallback(Session.CommandHandler callback)Sets the restart callback handler for this builderSession.BuilderserverAddr(String addr)Sets the server address for this builderSession.CommandHandlerstopCallback()Returns the stop callback handler for this builder.Session.BuilderstopCallback(Session.CommandHandler callback)Sets the stop callback handler for this builderSession.CommandHandlerupdateCallback()Returns the update callback handler for this builder.Session.BuilderupdateCallback(Session.CommandHandler callback)Sets the update callback handler for this builder
-
-
-
Method Detail
-
heartbeatInterval
public Session.Builder heartbeatInterval(Duration duration)
Sets the heartbeat interval for this builder- Parameters:
duration- the interval duration- Returns:
- the builder instance
-
heartbeatTolerance
public Session.Builder heartbeatTolerance(Duration duration)
Sets the heartbeat tolerance for this builder- Parameters:
duration- the tolerance duration- Returns:
- the builder instance
-
metadata
public Session.Builder metadata(String metadata)
Sets the metadata for this builder- Parameters:
metadata- the metadata- Returns:
- the builder instance
-
serverAddr
public Session.Builder serverAddr(String addr)
Sets the server address for this builder- Parameters:
addr- the server address- Returns:
- the builder instance
-
caCert
public Session.Builder caCert(byte[] data)
Sets the ca certificate for this builder- Parameters:
data- the ca certificate- Returns:
- the builder instance
-
stopCallback
public Session.Builder stopCallback(Session.CommandHandler callback)
Sets the stop callback handler for this builder- Parameters:
callback- the stop callback- Returns:
- the builder instance
-
restartCallback
public Session.Builder restartCallback(Session.CommandHandler callback)
Sets the restart callback handler for this builder- Parameters:
callback- the restart callback- Returns:
- the builder instance
-
updateCallback
public Session.Builder updateCallback(Session.CommandHandler callback)
Sets the update callback handler for this builder- Parameters:
callback- the update callback- Returns:
- the builder instance
-
heartbeatHandler
public Session.Builder heartbeatHandler(Session.HeartbeatHandler heartbeatHandler)
Sets the heartbeat handler for this builder- Parameters:
heartbeatHandler- the heartbeat callback- Returns:
- the builder instance
-
addClientInfo
public Session.Builder addClientInfo(String name, String version)
Adds a client info to the list of client info objects for this builder- Parameters:
name- the client nameversion- the client version- Returns:
- the builder instance
-
addClientInfo
public Session.Builder addClientInfo(String name, String version, String comments)
Adds a client info to the list of client info objects for this builder- Parameters:
name- the client nameversion- the client versioncomments- the comments- Returns:
- the builder instance
-
getAuthtoken
public String getAuthtoken()
Returns the ngrok authtoken associated with this builder.- Returns:
- the authtoken
-
getHeartbeatInterval
public Optional<Duration> getHeartbeatInterval()
Returns the heartbeat interval for this builder- Returns:
- the heartbeat interval
-
getHeartbeatTolerance
public Optional<Duration> getHeartbeatTolerance()
Returns the heartbeat tolerance for this builder- Returns:
- the heartbeat tolerance
-
getMetadata
public Optional<String> getMetadata()
Returns the metadata for this builder.- Returns:
- the metadata
-
getServerAddr
public Optional<String> getServerAddr()
Returns the server address for this builder.- Returns:
- the server address
-
getCaCert
public byte[] getCaCert()
Returns the certificate for this builder.- Returns:
- the certificate
-
stopCallback
public Session.CommandHandler stopCallback()
Returns the stop callback handler for this builder.- Returns:
- the stop handler
-
restartCallback
public Session.CommandHandler restartCallback()
Returns the restart callback handler for this builder.- Returns:
- the restart handler
-
updateCallback
public Session.CommandHandler updateCallback()
Returns the update callback handler for this builder.- Returns:
- the update handler
-
heartbeatHandler
public Session.HeartbeatHandler heartbeatHandler()
Returns the heartbeat handler for this builder.- Returns:
- the heartbeat handler
-
getClientInfos
public List<Session.ClientInfo> getClientInfos()
Returns the list of client info objects to add for this builder- Returns:
- the list of client info objects
-
connect
public Session connect() throws IOException
Connects a session with the currentSession.Builder- Returns:
- newly created session
- Throws:
IOException- if an I/O error occurs
-
-