unsw.cse.mica.agent.transport.secure
Class SSLAgentConnection

java.lang.Object
  extended by unsw.cse.mica.agent.transport.secure.SSLAgentConnection
All Implemented Interfaces:
AgentConnection

public class SSLAgentConnection
extends java.lang.Object
implements AgentConnection

An implementation of the AgentConnection interface using SSL sockets.

Author:
mmcgill

Constructor Summary
SSLAgentConnection(java.lang.String host, int port)
           
 
Method Summary
 void connect()
          Make a connection.
 void disconnect()
          terminate the connection.
 java.lang.String getHost()
           
 java.io.InputStream getInputStream()
          Get an input stream for this connection
 java.io.OutputStream getOutputStream()
          Get an output stream for this connection
 int getPort()
           
 boolean isConnected()
          Check if a connection is open.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SSLAgentConnection

public SSLAgentConnection(java.lang.String host,
                          int port)
Method Detail

getHost

public java.lang.String getHost()

getPort

public int getPort()

connect

public void connect()
             throws TransportException
Description copied from interface: AgentConnection
Make a connection. The details of how this occurs this will be implementation-specific.

Specified by:
connect in interface AgentConnection
Throws:
TransportException - if the connection could not be made

disconnect

public void disconnect()
                throws TransportException
Description copied from interface: AgentConnection
terminate the connection.

Specified by:
disconnect in interface AgentConnection
Throws:
TransportException - if something went wrong...

getInputStream

public java.io.InputStream getInputStream()
                                   throws TransportException
Description copied from interface: AgentConnection
Get an input stream for this connection

Specified by:
getInputStream in interface AgentConnection
Returns:
an input stream for this connection
Throws:
TransportException - if an inputstream could not be obtained for some reason.

getOutputStream

public java.io.OutputStream getOutputStream()
                                     throws TransportException
Description copied from interface: AgentConnection
Get an output stream for this connection

Specified by:
getOutputStream in interface AgentConnection
Returns:
an output stream for this connection
Throws:
TransportException - if an output stream could not be obtained for some reason.

isConnected

public boolean isConnected()
Description copied from interface: AgentConnection
Check if a connection is open.

Specified by:
isConnected in interface AgentConnection
Returns:
true if the connection is active, false otherwise