|
|||||||||
| 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.
| Field Summary | |
|---|---|
private DummyConnection |
otherConnection
|
private MessageHandler |
outgoingMessageHandler
The message handler to simulate using when receiving messages. |
| Constructor Summary | |
|---|---|
DummyConnection(java.lang.String name,
MessageHandler incomingMessageHandler)
Sets up a dummy connection using the specified MessageHandlers. |
|
| Method Summary | |
|---|---|
org.w3c.dom.Element |
ask(org.w3c.dom.Element request)
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. |
private void |
setOutgoingMessageHandler(MessageHandler mh)
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, askDumping, endTransmission, getMessageHandler, getName, getReply, getSocket, handleAndSendReply, reallyClose, send, setMessageHandler |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
private MessageHandler outgoingMessageHandler
private DummyConnection otherConnection
| Constructor Detail |
|---|
public DummyConnection(java.lang.String name,
MessageHandler incomingMessageHandler)
MessageHandlers.
incomingMessageHandler - The MessageHandler to call for each message
received.| Method Detail |
|---|
public void close()
throws java.io.IOException
close in class Connectionjava.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 Connectionelement - 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 request)
throws java.io.IOException
ask in class Connectionrequest - 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 Connectionelement - 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)private void setOutgoingMessageHandler(MessageHandler mh)
mh - The new MessageHandler for this Connection.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 | ||||||||