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 newEdgeBuilder
with a given session.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Forwarder.Edge
forward(URL url)
Start listening and forwarding connections to given url.Map<String,String>
getLabels()
Returns the label map for this builder.EdgeBuilder
label(String key, String value)
Adds a label with the specified key and value to this builder.Listener.Edge
listen()
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 newEdgeBuilder
with a given session.- Parameters:
session
- the session over which this listener will connect. Ifnull
,listen()
andforward(URL)
will throwNullPointerException
, use the corresponding methods on theSession
object 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.Builder
Starts listening and accepting new connections.- Specified by:
listen
in interfaceListener.Builder<Listener.Edge>
- Returns:
- the concrete
Listener
instance - Throws:
IOException
- if an I/O error occurs
-
forward
public Forwarder.Edge forward(URL url) throws IOException
Description copied from interface:Forwarder.Builder
Start listening and forwarding connections to given url.- Specified by:
forward
in interfaceForwarder.Builder<Forwarder.Edge>
- Parameters:
url
- to forward connections to- Returns:
- the concrete
Forwarder
instance - Throws:
IOException
- if an I/O error occurs
-
-