org.openuat.util
Interface RemoteConnection

All Known Implementing Classes:
BluetoothRFCOMMChannel, RemoteTCPConnection

public interface RemoteConnection

This interface represents an already opened, stream-oriented connection to a remote host, e.g. via TCP or via Bluetooth L2CAP/RFCOMM. The specific connection implementations should implement it with internal or anonymous classes so that authentication protocols can re-use connections.

Version:
1.0
Author:
Rene Mayrhofer

Method Summary
 void close()
          Closes the underlying connection cleanly and frees any resources held by it.
 boolean equals(java.lang.Object other)
          This must be implemented properly so that KeyManager can deal with keys for different hosts.
 java.io.InputStream getInputStream()
          Returns the InputStream to read from the remote side.
 java.io.OutputStream getOutputStream()
          Returns the OuputStream to write to the remote side.
 java.lang.Object getRemoteAddress()
          Returns the address of the remote host as appropriate object.
 java.lang.String getRemoteName()
          Returns the name of the remote host in appropriate representation, or null if it could not be resolved.
 boolean isOpen()
          Returns true if the unterlying connection is open in both directions, false otherwise.
 boolean open()
          (Re-)Opens the underlying connection.
 

Method Detail

getInputStream

java.io.InputStream getInputStream()
                                   throws java.io.IOException
Returns the InputStream to read from the remote side.

Throws:
java.io.IOException

getOutputStream

java.io.OutputStream getOutputStream()
                                     throws java.io.IOException
Returns the OuputStream to write to the remote side.

Throws:
java.io.IOException

getRemoteName

java.lang.String getRemoteName()
Returns the name of the remote host in appropriate representation, or null if it could not be resolved.


getRemoteAddress

java.lang.Object getRemoteAddress()
                                  throws java.io.IOException
Returns the address of the remote host as appropriate object.

Throws:
java.io.IOException

open

boolean open()
             throws java.io.IOException
(Re-)Opens the underlying connection. This may not be possible, depending on the implementation.

Returns:
true if the connection could be (re-)opened, false otherwise.
Throws:
java.io.IOException

close

void close()
Closes the underlying connection cleanly and frees any resources held by it.


isOpen

boolean isOpen()
Returns true if the unterlying connection is open in both directions, false otherwise.

Returns:
true if the connection can be used for sending and receiving, false if either (or both) of the channels is unusable (closed).

equals

boolean equals(java.lang.Object other)
This must be implemented properly so that KeyManager can deal with keys for different hosts. End point descriptions should be compared, e.g. IP address and port or Bluetooth MAC address and RFCOMM channel nummber.

Overrides:
equals in class java.lang.Object


2005-2006, Rene Mayrhofer.