Package org.eclipse.jetty.io.ssl
Class SslConnection.DecryptedEndPoint
- java.lang.Object
-
- org.eclipse.jetty.io.IdleTimeout
-
- org.eclipse.jetty.io.AbstractEndPoint
-
- org.eclipse.jetty.io.ssl.SslConnection.DecryptedEndPoint
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
,EndPoint
- Enclosing class:
- SslConnection
public class SslConnection.DecryptedEndPoint extends AbstractEndPoint
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private class
SslConnection.DecryptedEndPoint.IncompleteWriteCallback
-
Field Summary
Fields Modifier and Type Field Description private java.lang.Throwable
_failure
private Callback
_incompleteWriteCallback
-
Constructor Summary
Constructors Constructor Description DecryptedEndPoint()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private boolean
allowRenegotiate()
private java.lang.Throwable
closeInbound()
private void
closeOutbound()
void
doClose()
void
doShutdownOutput()
private void
ensureFillInterested()
int
fill(java.nio.ByteBuffer buffer)
Fill the passed buffer with data from this endpoint.boolean
flush(java.nio.ByteBuffer... appOuts)
Flush data from the passed header/buffer to this endpoint.long
getIdleTimeout()
Get the max idle time in ms.java.net.InetSocketAddress
getLocalAddress()
java.net.InetSocketAddress
getRemoteAddress()
SslConnection
getSslConnection()
java.lang.Object
getTransport()
WriteFlusher
getWriteFlusher()
private java.lang.Throwable
handleException(java.lang.Throwable x, java.lang.String context)
private java.lang.Throwable
handshakeFailed(java.lang.Throwable failure)
private void
handshakeSucceeded()
private boolean
isInboundDone()
boolean
isInputShutdown()
Test if the input is shutdown.boolean
isOpen()
This abstract method should be called to check if idle timeouts should still be checked.private boolean
isOutboundDone()
boolean
isOutputShutdown()
Test if output is shutdown.private boolean
isRenegotiating()
private boolean
isTLS13()
protected void
needsFillInterest()
private void
notifyHandshakeFailed(javax.net.ssl.SSLEngine sslEngine, java.lang.Throwable failure)
private void
notifyHandshakeSucceeded(javax.net.ssl.SSLEngine sslEngine)
protected void
onFillable()
protected void
onFillableFail(java.lang.Throwable failure)
protected void
onIncompleteFlush()
private void
rethrow(java.lang.Throwable x)
void
setConnection(Connection connection)
void
setIdleTimeout(long idleTimeout)
Sets the idle timeout in milliseconds.private void
terminateInput()
java.lang.String
toString()
-
Methods inherited from class org.eclipse.jetty.io.AbstractEndPoint
checkFill, checkFlush, close, close, doShutdownInput, fillInterested, getConnection, getCreatedTimeStamp, getFillInterest, isFillInterested, isOptimizedForDirectBuffers, onClose, onClose, onIdleExpired, onOpen, reset, shutdownInput, shutdownOutput, toConnectionString, toEndPointString, tryFillInterested, upgrade, write
-
Methods inherited from class org.eclipse.jetty.io.IdleTimeout
checkIdleTimeout, getIdleFor, getScheduler, notIdle
-
-
-
-
Field Detail
-
_incompleteWriteCallback
private final Callback _incompleteWriteCallback
-
_failure
private java.lang.Throwable _failure
-
-
Method Detail
-
getIdleTimeout
public long getIdleTimeout()
Description copied from interface:EndPoint
Get the max idle time in ms.The max idle time is the time the endpoint can be idle before extraordinary handling takes place.
- Specified by:
getIdleTimeout
in interfaceEndPoint
- Overrides:
getIdleTimeout
in classIdleTimeout
- Returns:
- the idle timeout in milliseconds
- See Also:
IdleTimeout.setIdleTimeout(long)
-
setIdleTimeout
public void setIdleTimeout(long idleTimeout)
Description copied from class:IdleTimeout
Sets the idle timeout in milliseconds.
A value that is less than or zero disables the idle timeout checks.
- Specified by:
setIdleTimeout
in interfaceEndPoint
- Overrides:
setIdleTimeout
in classIdleTimeout
- Parameters:
idleTimeout
- the idle timeout in milliseconds- See Also:
IdleTimeout.getIdleTimeout()
-
isOpen
public boolean isOpen()
Description copied from class:IdleTimeout
This abstract method should be called to check if idle timeouts should still be checked.- Specified by:
isOpen
in interfaceEndPoint
- Overrides:
isOpen
in classAbstractEndPoint
- Returns:
- True if the entity monitored should still be checked for idle timeouts
-
getLocalAddress
public java.net.InetSocketAddress getLocalAddress()
- Returns:
- The local Inet address to which this
EndPoint
is bound, ornull
if thisEndPoint
does not represent a network connection.
-
getRemoteAddress
public java.net.InetSocketAddress getRemoteAddress()
- Returns:
- The remote Inet address to which this
EndPoint
is bound, ornull
if thisEndPoint
does not represent a network connection.
-
getWriteFlusher
public WriteFlusher getWriteFlusher()
- Overrides:
getWriteFlusher
in classAbstractEndPoint
-
onFillable
protected void onFillable()
-
onFillableFail
protected void onFillableFail(java.lang.Throwable failure)
-
setConnection
public void setConnection(Connection connection)
- Specified by:
setConnection
in interfaceEndPoint
- Overrides:
setConnection
in classAbstractEndPoint
- Parameters:
connection
- theConnection
associated with this EndPoint- See Also:
EndPoint.getConnection()
,EndPoint.upgrade(Connection)
-
getSslConnection
public SslConnection getSslConnection()
-
fill
public int fill(java.nio.ByteBuffer buffer) throws java.io.IOException
Description copied from interface:EndPoint
Fill the passed buffer with data from this endpoint. The bytes are appended to any data already in the buffer by writing from the buffers limit up to it's capacity. The limit is updated to include the filled bytes.- Parameters:
buffer
- The buffer to fill. The position and limit are modified during the fill. After the operation, the position is unchanged and the limit is increased to reflect the new data filled.- Returns:
- an
int
value indicating the number of bytes filled or -1 if EOF is read or the input is shutdown. - Throws:
java.io.IOException
- if the endpoint is closed.
-
needsFillInterest
protected void needsFillInterest()
- Specified by:
needsFillInterest
in classAbstractEndPoint
-
handshakeSucceeded
private void handshakeSucceeded() throws javax.net.ssl.SSLException
- Throws:
javax.net.ssl.SSLException
-
handshakeFailed
private java.lang.Throwable handshakeFailed(java.lang.Throwable failure)
-
terminateInput
private void terminateInput()
-
closeInbound
private java.lang.Throwable closeInbound() throws javax.net.ssl.SSLException
- Throws:
javax.net.ssl.SSLException
-
flush
public boolean flush(java.nio.ByteBuffer... appOuts) throws java.io.IOException
Description copied from interface:EndPoint
Flush data from the passed header/buffer to this endpoint. As many bytes as can be consumed are taken from the header/buffer position up until the buffer limit. The header/buffers position is updated to indicate how many bytes have been consumed.- Parameters:
appOuts
- the buffers to flush- Returns:
- True IFF all the buffers have been consumed and the endpoint has flushed the data to its destination (ie is not buffering any data).
- Throws:
java.io.IOException
- If the endpoint is closed or output is shutdown.
-
onIncompleteFlush
protected void onIncompleteFlush()
- Specified by:
onIncompleteFlush
in classAbstractEndPoint
-
doShutdownOutput
public void doShutdownOutput()
- Overrides:
doShutdownOutput
in classAbstractEndPoint
-
closeOutbound
private void closeOutbound()
-
ensureFillInterested
private void ensureFillInterested()
-
isOutputShutdown
public boolean isOutputShutdown()
Description copied from interface:EndPoint
Test if output is shutdown. The output is shutdown by a call toEndPoint.shutdownOutput()
orEndPoint.close()
.- Specified by:
isOutputShutdown
in interfaceEndPoint
- Overrides:
isOutputShutdown
in classAbstractEndPoint
- Returns:
- true if the output is shutdown or the endpoint is closed.
-
isOutboundDone
private boolean isOutboundDone()
-
doClose
public void doClose()
- Overrides:
doClose
in classAbstractEndPoint
-
getTransport
public java.lang.Object getTransport()
- Returns:
- The underlying transport object (socket, channel, etc.)
-
isInputShutdown
public boolean isInputShutdown()
Description copied from interface:EndPoint
Test if the input is shutdown. The input is shutdown if an EOF has been read while doing aEndPoint.fill(ByteBuffer)
. Once the input is shutdown, all calls toEndPoint.fill(ByteBuffer)
will return -1, until such time as the end point is close, when they will returnEofException
.- Specified by:
isInputShutdown
in interfaceEndPoint
- Overrides:
isInputShutdown
in classAbstractEndPoint
- Returns:
- True if the input is shutdown or the endpoint is closed.
-
isInboundDone
private boolean isInboundDone()
-
notifyHandshakeSucceeded
private void notifyHandshakeSucceeded(javax.net.ssl.SSLEngine sslEngine) throws javax.net.ssl.SSLException
- Throws:
javax.net.ssl.SSLException
-
notifyHandshakeFailed
private void notifyHandshakeFailed(javax.net.ssl.SSLEngine sslEngine, java.lang.Throwable failure)
-
isRenegotiating
private boolean isRenegotiating()
-
allowRenegotiate
private boolean allowRenegotiate()
-
isTLS13
private boolean isTLS13()
-
handleException
private java.lang.Throwable handleException(java.lang.Throwable x, java.lang.String context)
-
rethrow
private void rethrow(java.lang.Throwable x) throws java.io.IOException
- Throws:
java.io.IOException
-
toString
public java.lang.String toString()
- Overrides:
toString
in classAbstractEndPoint
-
-