Fixed timeout bug in setCONN and strengthened test for setCONN.
This commit is contained in:
@@ -579,11 +579,13 @@ public class XPlaneConnect implements AutoCloseable
|
|||||||
ByteArrayOutputStream os = new ByteArrayOutputStream();
|
ByteArrayOutputStream os = new ByteArrayOutputStream();
|
||||||
os.write("CONN".getBytes(StandardCharsets.UTF_8));
|
os.write("CONN".getBytes(StandardCharsets.UTF_8));
|
||||||
os.write(0xFF); //Placeholder for message length
|
os.write(0xFF); //Placeholder for message length
|
||||||
os.write((byte)recvPort);
|
os.write((byte) recvPort);
|
||||||
os.write((byte)(recvPort >> 8));
|
os.write((byte) (recvPort >> 8));
|
||||||
sendUDP(os.toByteArray());
|
sendUDP(os.toByteArray());
|
||||||
|
|
||||||
|
int soTimeout = socket.getSoTimeout();
|
||||||
socket.close();
|
socket.close();
|
||||||
socket = new DatagramSocket(recvPort);
|
socket = new DatagramSocket(recvPort);
|
||||||
|
socket.setSoTimeout(soTimeout);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -467,6 +467,8 @@ public class XPlaneConnectTest
|
|||||||
|
|
||||||
xpc.setCONN(p);
|
xpc.setCONN(p);
|
||||||
assertEquals(p, xpc.getRecvPort());
|
assertEquals(p, xpc.getRecvPort());
|
||||||
|
result = xpc.requestDREF(dref);
|
||||||
|
assertEquals(1, result.length);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user