3 import java.util.Arrays;
5 public class Connection {
11 * Remote peer bitfield.
13 public char bitfield[];
17 public String mailbox;
19 * Indicates if we are interested in something this peer has
21 public boolean amInterested = false;
23 * Indicates if the peer is interested in one of our pieces
25 public boolean interested = false;
27 * Indicates if the peer is choked for the current peer
29 public boolean chokedUpload = true;
31 * Indicates if the peer has choked the current peer
33 public boolean chokedDownload = true;
38 public Connection(int id) {
40 this.mailbox = Integer.toString(id);
44 public String toString() {
45 return "Connection [id=" + id + ", bitfield="
46 + Arrays.toString(bitfield) + ", mailbox=" + mailbox
47 + ", amInterested=" + amInterested + ", interested="
48 + interested + ", chokedUpload=" + chokedUpload
49 + ", chokedDownload=" + chokedDownload + "]";