Package com.ngrok.jetty
Class NgrokEndpoint
- java.lang.Object
-
- org.eclipse.jetty.io.IdleTimeout
-
- org.eclipse.jetty.io.AbstractEndPoint
-
- com.ngrok.jetty.NgrokEndpoint
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
,org.eclipse.jetty.io.EndPoint
public class NgrokEndpoint extends org.eclipse.jetty.io.AbstractEndPoint
A class representing an endpoint for ngrok connection.
-
-
Constructor Summary
Constructors Constructor Description NgrokEndpoint(org.eclipse.jetty.util.thread.Scheduler scheduler, Connection conn)
Constructs a new ngrok endpoint with the specified scheduler and connection.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
fill(ByteBuffer buffer)
Fills the endpoint with data from the connection.boolean
flush(ByteBuffer... buffer)
Flushes the endpoint with data from the connection.SocketAddress
getLocalSocketAddress()
SocketAddress
getRemoteSocketAddress()
Object
getTransport()
Throws anUnsupportedOperationException
, as the transport used by ngrok endpoints is not supported.protected void
needsFillInterest()
Schedules the endpoint to be filled with interest.protected void
onIncompleteFlush()
Throws anUnsupportedOperationException
, as incomplete flush is not supported by ngrok endpoints.-
Methods inherited from class org.eclipse.jetty.io.AbstractEndPoint
close, close, doClose, doShutdownInput, doShutdownOutput, fillInterested, getConnection, getCreatedTimeStamp, getFillInterest, getLocalAddress, getRemoteAddress, getWriteFlusher, isFillInterested, isInputShutdown, isOpen, isOutputShutdown, onClose, onClose, onIdleExpired, onOpen, reset, setConnection, shutdownInput, shutdownOutput, toConnectionString, toEndPointString, toString, tryFillInterested, upgrade, write
-
Methods inherited from class org.eclipse.jetty.io.IdleTimeout
checkIdleTimeout, getIdleFor, getIdleTimeout, getScheduler, notIdle, setIdleTimeout
-
-
-
-
Constructor Detail
-
NgrokEndpoint
public NgrokEndpoint(org.eclipse.jetty.util.thread.Scheduler scheduler, Connection conn)
Constructs a new ngrok endpoint with the specified scheduler and connection.- Parameters:
scheduler
- the scheduler to use for the endpointconn
- the connection to use for the endpoint
-
-
Method Detail
-
onIncompleteFlush
protected void onIncompleteFlush()
Throws anUnsupportedOperationException
, as incomplete flush is not supported by ngrok endpoints.- Specified by:
onIncompleteFlush
in classorg.eclipse.jetty.io.AbstractEndPoint
- Throws:
UnsupportedOperationException
- if the method is called
-
needsFillInterest
protected void needsFillInterest() throws IOException
Schedules the endpoint to be filled with interest.- Specified by:
needsFillInterest
in classorg.eclipse.jetty.io.AbstractEndPoint
- Throws:
IOException
- if an I/O error occurs
-
fill
public int fill(ByteBuffer buffer) throws IOException
Fills the endpoint with data from the connection.- Parameters:
buffer
- the buffer to fill with data- Returns:
- the number of bytes read from the connection
- Throws:
IOException
- if an I/O error occurs
-
flush
public boolean flush(ByteBuffer... buffer) throws IOException
Flushes the endpoint with data from the connection.- Parameters:
buffer
- the buffer to flush with data- Returns:
- true if the buffer was completely flushed, false otherwise
- Throws:
IOException
- if an I/O error occurs
-
getTransport
public Object getTransport()
Throws anUnsupportedOperationException
, as the transport used by ngrok endpoints is not supported.- Throws:
UnsupportedOperationException
- if the method is called
-
getLocalSocketAddress
public SocketAddress getLocalSocketAddress()
- Specified by:
getLocalSocketAddress
in interfaceorg.eclipse.jetty.io.EndPoint
- Overrides:
getLocalSocketAddress
in classorg.eclipse.jetty.io.AbstractEndPoint
-
getRemoteSocketAddress
public SocketAddress getRemoteSocketAddress()
- Specified by:
getRemoteSocketAddress
in interfaceorg.eclipse.jetty.io.EndPoint
- Overrides:
getRemoteSocketAddress
in classorg.eclipse.jetty.io.AbstractEndPoint
-
-