add tests for Parser
This commit is contained in:
@@ -249,7 +249,7 @@ public abstract class Socket extends Emitter {
|
||||
transport[0].off(Transport.EVENT_ERROR, onerror);
|
||||
self.emit(EVENT_UPGRADE, transport);
|
||||
self.setTransport(transport[0]);
|
||||
Packet packet = new Packet(Packet.UPGRADE, null);
|
||||
Packet packet = new Packet(Packet.UPGRADE);
|
||||
transport[0].send(new Packet[]{packet});
|
||||
transport[0] = null;
|
||||
self.upgrading = false;
|
||||
|
||||
@@ -15,14 +15,12 @@ public class Packet {
|
||||
public String type;
|
||||
public String data;
|
||||
|
||||
public Packet(String type) {
|
||||
this(type, null);
|
||||
}
|
||||
|
||||
public Packet(String type, String data) {
|
||||
this.type = type;
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.format("{\"type\": \"%s\", \"data\": \"%s\"}", this.type, this.data);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -114,6 +114,7 @@ public class Parser {
|
||||
}
|
||||
|
||||
public static interface DecodePayloadCallback {
|
||||
|
||||
public boolean call(Packet packet, int index, int total);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user