|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.freecol.common.networking.Connection
net.sf.freecol.server.networking.DummyConnection
public final class DummyConnection
A dummy connection, used for AI players.
Constructor Summary | |
---|---|
DummyConnection(java.lang.String name,
MessageHandler incomingMessageHandler)
Sets up a dummy connection using the specified MessageHandler s. |
Method Summary | |
---|---|
org.w3c.dom.Element |
ask(org.w3c.dom.Element element)
Sends a message to the other peer and returns the reply. |
void |
close()
Closes this connection. |
DummyConnection |
getOtherConnection()
Gets the DummyConnection this object is connected to. |
void |
send(org.w3c.dom.Element element)
Sends the given message over this Connection. |
void |
sendAndWait(org.w3c.dom.Element element)
Sends the given message over this Connection and waits for
confirmation of receiveval before returning. |
void |
setOutgoingMessageHandler(DummyConnection c)
Sets the outgoing MessageHandler for this Connection. |
java.lang.String |
toString()
Return a human-readable string with the dummy connection name. |
Methods inherited from class net.sf.freecol.common.networking.Connection |
---|
ask, endTransmission, getMessageHandler, getReply, getSocket, handleAndSendReply, reallyClose, send, setMessageHandler |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public DummyConnection(java.lang.String name, MessageHandler incomingMessageHandler)
MessageHandler
s.
name
- The name that identifies the connection.incomingMessageHandler
- The MessageHandler to call for each message
received.Method Detail |
---|
public void close() throws java.io.IOException
close
in class Connection
java.io.IOException
- Will not be thrown by a DummyConnection
,
but added because of the superclass' specification.public void send(org.w3c.dom.Element element) throws java.io.IOException
send
in class Connection
element
- The element (root element in a DOM-parsed XML tree) that
holds all the information
java.io.IOException
- If an error occur while sending the message.sendAndWait(Element)
,
ask(Element)
public org.w3c.dom.Element ask(org.w3c.dom.Element element) throws java.io.IOException
ask
in class Connection
element
- The question for the other peer.
java.io.IOException
- If an error occur while sending the message.send(org.w3c.dom.Element)
,
sendAndWait(org.w3c.dom.Element)
public void sendAndWait(org.w3c.dom.Element element) throws java.io.IOException
Connection
and waits for
confirmation of receiveval before returning.
sendAndWait
in class Connection
element
- The element (root element in a DOM-parsed XML tree) that
holds all the information
java.io.IOException
- If an error occur while sending the message.send(Element)
,
ask(Element)
public void setOutgoingMessageHandler(DummyConnection c)
c
- The connectio to get the messagehandler from.public DummyConnection getOtherConnection()
DummyConnection
this object is connected to.
DummyConnection
.public java.lang.String toString()
toString
in class Connection
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |