Class LoopbackConnectionHandler
java.lang.Object
org.tentackle.trip.transport.ConnectionHandler
org.tentackle.trip.transport.LoopbackConnectionHandler
- All Implemented Interfaces:
Runnable
Loopback connection handler for testing purposes.
-
Constructor Summary
ConstructorsConstructorDescriptionLoopbackConnectionHandler(LoopbackTransport transport, String name, InputStream inputStream, OutputStream outputStream) Creates a new handler. -
Method Summary
Modifier and TypeMethodDescriptionprotected TripStreamcreateStream(UUID id, boolean clientDictionaryEmpty) Creates a new stream for the given UUID.protected booleanChecks whether the connection is still alive.protected booleanisErrorSuppressed(PreAuthenticationPolicy policy, PreAuthenticationPolicy.Admission admission) Returns whether errors are not answered.
As long as the client is not authenticated by an enforcing policy, the server sends nothing but the responses of successful calls.protected booleanReturns whether rejections are delayed by theRejectionDelay.
A peer must not tell from the response time why it was rejected, or whether it talks to a TRIP server at all.Methods inherited from class ConnectionHandler
evict, getConnectionName, getInputStream, getOutputStream, getPeerCertificates, getTransport, isAuthenticated, run
-
Constructor Details
-
LoopbackConnectionHandler
public LoopbackConnectionHandler(LoopbackTransport transport, String name, InputStream inputStream, OutputStream outputStream) Creates a new handler.- Parameters:
transport- the transport associated with this handlername- the name of the connectioninputStream- the input stream associated with this connectionoutputStream- the output stream associated with this connection
-
-
Method Details
-
createStream
Description copied from class:ConnectionHandlerCreates a new stream for the given UUID.- Overrides:
createStreamin classConnectionHandler- Parameters:
id- the UUID of the client's transportclientDictionaryEmpty- true if the client's dictionary is still empty- Returns:
- the trip stream
-
isRejectionDelayed
protected boolean isRejectionDelayed()Returns whether rejections are delayed by theRejectionDelay.
A peer must not tell from the response time why it was rejected, or whether it talks to a TRIP server at all.The loopback client runs in the same JVM: there is nobody to hide from.
- Overrides:
isRejectionDelayedin classConnectionHandler- Returns:
- false
-
isErrorSuppressed
protected boolean isErrorSuppressed(PreAuthenticationPolicy policy, PreAuthenticationPolicy.Admission admission) Returns whether errors are not answered.
As long as the client is not authenticated by an enforcing policy, the server sends nothing but the responses of successful calls. An error message would tell a prober that it talks to a TRIP server.The loopback client waits for an answer.
- Overrides:
isErrorSuppressedin classConnectionHandler- Parameters:
policy- the pre-authentication policy, null if noneadmission- the admission, null if none or authenticated- Returns:
- false
-
isConnectionAlive
protected boolean isConnectionAlive()Description copied from class:ConnectionHandlerChecks whether the connection is still alive.- Overrides:
isConnectionAlivein classConnectionHandler- Returns:
- true if the connection is still alive, false to terminate the handler
-