Package com.ngrok
Class EdgeBuilder
- java.lang.Object
-
- com.ngrok.MetadataBuilder<EdgeBuilder>
-
- com.ngrok.EdgeBuilder
-
- All Implemented Interfaces:
Forwarder.Builder<Forwarder.Edge>,Listener.Builder<Listener.Edge>
public class EdgeBuilder extends MetadataBuilder<EdgeBuilder> implements Listener.Builder<Listener.Edge>, Forwarder.Builder<Forwarder.Edge>
A builder for creating an edge listener
-
-
Constructor Summary
Constructors Constructor Description EdgeBuilder(Session session)Creates a newEdgeBuilderwith a given session.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Forwarder.Edgeforward(URL url)Start listening and forwarding connections to given url.Map<String,String>getLabels()Returns the label map for this builder.EdgeBuilderlabel(String key, String value)Adds a label with the specified key and value to this builder.Listener.Edgelisten()Starts listening and accepting new connections.-
Methods inherited from class com.ngrok.MetadataBuilder
forwardsTo, getForwardsTo, getMetadata, metadata
-
-
-
-
Constructor Detail
-
EdgeBuilder
public EdgeBuilder(Session session)
Creates a newEdgeBuilderwith a given session.- Parameters:
session- the session over which this listener will connect. Ifnull,listen()andforward(URL)will throwNullPointerException, use the corresponding methods on theSessionobject directly.
-
-
Method Detail
-
label
public EdgeBuilder label(String key, String value)
Adds a label with the specified key and value to this builder.- Parameters:
key- the key of the labelvalue- the value of the label- Returns:
- the builder instance
-
getLabels
public Map<String,String> getLabels()
Returns the label map for this builder.- Returns:
- a label map, string keys and values
-
listen
public Listener.Edge listen() throws IOException
Description copied from interface:Listener.BuilderStarts listening and accepting new connections.- Specified by:
listenin interfaceListener.Builder<Listener.Edge>- Returns:
- the concrete
Listenerinstance - Throws:
IOException- if an I/O error occurs
-
forward
public Forwarder.Edge forward(URL url) throws IOException
Description copied from interface:Forwarder.BuilderStart listening and forwarding connections to given url.- Specified by:
forwardin interfaceForwarder.Builder<Forwarder.Edge>- Parameters:
url- to forward connections to- Returns:
- the concrete
Forwarderinstance - Throws:
IOException- if an I/O error occurs
-
-