|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.sun.jmx.remote.socket.SocketConnection
public class SocketConnection
This class uses TCP sockets to implement a JMX client MessageConnection.
| Constructor Summary | |
|---|---|
SocketConnection(Socket socket)
Constructs a TCP socket client connection from a given socket. |
|
SocketConnection(String addr,
int port)
Constructs a TCP socket client connection from the given address and port. |
|
| Method Summary | |
|---|---|
void |
close()
Terminates this object connection. |
void |
connect(Map env)
Establish the connection. |
String |
getConnectionId()
The ID for this connection. |
Socket |
getSocket()
Returns a reference to the underlying socket. |
Message |
readMessage()
Reads a Message object from the other end of the
connection. |
void |
replaceStreams(InputStream is,
OutputStream os)
Replaces the current socket's input/output streams by the ones provided. |
void |
setSocket(Socket s)
Replaces the underlying socket. |
void |
setSubject(Subject subject)
Sets the subject authenticated through this socket connection. |
void |
writeMessage(Message msg)
Writes a Message object to the other end of the
connection. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SocketConnection(Socket socket)
throws IOException
socket - a TCP socket created by a user.
IOException
public SocketConnection(String addr,
int port)
throws IOException
addr - the server host address.port - the server port.
IOException| Method Detail |
|---|
public void connect(Map env)
throws IOException
MessageConnectionEstablish the connection. This method must be called before any other method of this interface. The behavior is unspecified if not.
connect in interface MessageConnectionenv - the properties of the connection.
IOException - if the connection cannot be made.public Socket getSocket()
getSocket in interface SocketConnectionIf
public void setSocket(Socket s)
throws IOException
setSocket in interface SocketConnectionIfIOException
public void replaceStreams(InputStream is,
OutputStream os)
throws IOException
replaceStreams in interface SocketConnectionIfIOExceptionpublic void setSubject(Subject subject)
setSubject in interface SocketConnectionIf
public Message readMessage()
throws IOException,
ClassNotFoundException
MessageConnectionReads a Message object from the other end of the
connection.
readMessage in interface MessageConnectionIOException - if a message could not be read because
of a communication problem.
ClassNotFoundException - If the class of a serialized
object cannot be found.
public void writeMessage(Message msg)
throws IOException
MessageConnectionWrites a Message object to the other end of the
connection.
writeMessage in interface MessageConnectionmsg - the message to be written.
IOException - if the message could not be written
because of a communication problem.public void close()
MessageConnectionTerminates this object connection. After calling this
method, any current or new call to readMessage or MessageConnection.writeMessage(Message) should produce an
IOException.
close in interface MessageConnectionpublic String getConnectionId()
MessageConnectionThe ID for this connection.
getConnectionId in interface MessageConnection
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||