8392460e433169e5b74415a8b932efab6d5cb649
1 use std
::io
::{ TcpStream
, IoResult
};
2 use command
::{ Command
, Packet
, Error
};
12 pub fn new(address
: &str, port
: u16) -> IoResult
<Client
> {
14 socket
: try!(TcpStream
::connect(address
, port
)),
20 pub fn close(&mut self) {
21 self.socket
.close_read();
22 self.socket
.close_write();
25 pub fn start_tests(&mut self) {
27 let command
= Packet
::newRandomCommand(self.current_timestamp
);
32 fn send(&mut self, p
: Packet
) {
33 p
.write(&mut self.socket
);