org.apache.avro.ipc
Class SaslSocketTransceiver

java.lang.Object
  extended by org.apache.avro.ipc.Transceiver
      extended by org.apache.avro.ipc.SaslSocketTransceiver
All Implemented Interfaces:
Closeable

public class SaslSocketTransceiver
extends Transceiver

A Transceiver that uses javax.security.sasl for authentication and encryption.


Constructor Summary
SaslSocketTransceiver(SocketAddress address)
          Create using SASL's anonymous (RFC 2245) mechanism.
SaslSocketTransceiver(SocketAddress address, SaslClient saslClient)
          Create using the specified SaslClient.
SaslSocketTransceiver(SocketChannel channel, SaslServer saslServer)
          Create using the specified SaslServer.
 
Method Summary
 void close()
           
 Protocol getRemote()
          Returns the protocol passed to Transceiver.setRemote(Protocol).
 String getRemoteName()
           
 boolean isConnected()
          True if a handshake has been completed for this connection.
 List<ByteBuffer> readBuffers()
          Called by the default definition of Transceiver.transceive(List).
 void setRemote(Protocol remote)
          Called with the remote protocol when a handshake has been completed.
 List<ByteBuffer> transceive(List<ByteBuffer> request)
          Called by Requestor.request(String,Object) for two-way messages.
 void writeBuffers(List<ByteBuffer> buffers)
          Called by Requestor.request(String,Object) for one-way messages.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SaslSocketTransceiver

public SaslSocketTransceiver(SocketAddress address)
                      throws IOException
Create using SASL's anonymous (RFC 2245) mechanism.

Throws:
IOException

SaslSocketTransceiver

public SaslSocketTransceiver(SocketAddress address,
                             SaslClient saslClient)
                      throws IOException
Create using the specified SaslClient.

Throws:
IOException

SaslSocketTransceiver

public SaslSocketTransceiver(SocketChannel channel,
                             SaslServer saslServer)
                      throws IOException
Create using the specified SaslServer.

Throws:
IOException
Method Detail

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 class Transceiver

setRemote

public void setRemote(Protocol remote)
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 class Transceiver

getRemote

public Protocol getRemote()
Description copied from class: Transceiver
Returns the protocol passed to Transceiver.setRemote(Protocol). Throws IllegalStateException by default.

Overrides:
getRemote in class Transceiver

getRemoteName

public String getRemoteName()
Specified by:
getRemoteName in class Transceiver

transceive

public List<ByteBuffer> transceive(List<ByteBuffer> request)
                            throws IOException
Description copied from class: Transceiver
Called by Requestor.request(String,Object) for two-way messages. By default calls Transceiver.writeBuffers(List) followed by Transceiver.readBuffers().

Overrides:
transceive in class Transceiver
Throws:
IOException

readBuffers

public List<ByteBuffer> readBuffers()
                             throws IOException
Description copied from class: Transceiver
Called by the default definition of Transceiver.transceive(List).

Specified by:
readBuffers in class Transceiver
Throws:
IOException

writeBuffers

public void writeBuffers(List<ByteBuffer> buffers)
                  throws IOException
Description copied from class: Transceiver
Called by Requestor.request(String,Object) for one-way messages.

Specified by:
writeBuffers in class Transceiver
Throws:
IOException

close

public void close()
           throws IOException
Specified by:
close in interface Closeable
Overrides:
close in class Transceiver
Throws:
IOException


Copyright © 2010 The Apache Software Foundation