Package org.apache.avro.ipc
Class SaslSocketTransceiver
java.lang.Object
org.apache.avro.ipc.Transceiver
org.apache.avro.ipc.SaslSocketTransceiver
- All Implemented Interfaces:
Closeable
,AutoCloseable
A
Transceiver
that uses javax.security.sasl
for
authentication and encryption.-
Constructor Summary
ConstructorDescriptionSaslSocketTransceiver
(SocketAddress address) Create using SASL's anonymous (RFC 2245) mechanism.SaslSocketTransceiver
(SocketAddress address, SaslClient saslClient) Create using the specifiedSaslClient
.SaslSocketTransceiver
(SocketChannel channel, SaslServer saslServer) Create using the specifiedSaslServer
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Returns the protocol passed toTransceiver.setRemote(Protocol)
.boolean
True if a handshake has been completed for this connection.Called by the default definition ofTransceiver.transceive(List)
.void
Called with the remote protocol when a handshake has been completed.transceive
(List<ByteBuffer> request) Called byRequestor.request(String,Object)
for two-way messages.void
writeBuffers
(List<ByteBuffer> buffers) Called byRequestor.request(String,Object)
for one-way messages.Methods inherited from class org.apache.avro.ipc.Transceiver
lockChannel, transceive, unlockChannel
-
Constructor Details
-
SaslSocketTransceiver
Create using SASL's anonymous (RFC 2245) mechanism.- Throws:
IOException
-
SaslSocketTransceiver
Create using the specifiedSaslClient
.- Throws:
IOException
-
SaslSocketTransceiver
Create using the specifiedSaslServer
.- Throws:
IOException
-
-
Method Details
-
isConnected
public boolean isConnected()Description copied from class:Transceiver
True if a handshake has been completed for this connection. Used to determine whether a handshake need be completed prior to a one-way message. Requests and responses are always prefixed by handshakes, but one-way messages. If the first request sent over a connection is one-way, then a handshake-only response is returned. Subsequent one-way messages over the connection will have no response data sent. Returns false by default.- Overrides:
isConnected
in classTransceiver
-
setRemote
Description copied from class:Transceiver
Called with the remote protocol when a handshake has been completed. After this has been called and while a connection is maintained,Transceiver.isConnected()
should return true and #getRemote() should return this protocol. Does nothing by default.- Overrides:
setRemote
in classTransceiver
-
getRemote
Description copied from class:Transceiver
Returns the protocol passed toTransceiver.setRemote(Protocol)
. Throws IllegalStateException by default.- Overrides:
getRemote
in classTransceiver
-
getRemoteName
- Specified by:
getRemoteName
in classTransceiver
-
transceive
Description copied from class:Transceiver
Called byRequestor.request(String,Object)
for two-way messages. By default callsTransceiver.writeBuffers(List)
followed byTransceiver.readBuffers()
.- Overrides:
transceive
in classTransceiver
- Throws:
IOException
-
readBuffers
Description copied from class:Transceiver
Called by the default definition ofTransceiver.transceive(List)
.- Specified by:
readBuffers
in classTransceiver
- Throws:
IOException
-
writeBuffers
Description copied from class:Transceiver
Called byRequestor.request(String,Object)
for one-way messages.- Specified by:
writeBuffers
in classTransceiver
- Throws:
IOException
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classTransceiver
- Throws:
IOException
-