mirror of
https://github.com/michaelrausch/Party-Parrots-At-Sea.git
synced 2026-05-09 06:18:44 +00:00
Added reasonable testing for StreamReciever, further testing would probably need StreamReciever to be rewritten #story[817]
This commit is contained in:
@@ -19,6 +19,7 @@ public class StreamReceiver {
|
||||
public StreamReceiver(String hostAddress, int hostPort, PriorityBlockingQueue packetBuffer) {
|
||||
try {
|
||||
host = new Socket(hostAddress, hostPort);
|
||||
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
System.exit(1);
|
||||
@@ -26,6 +27,12 @@ public class StreamReceiver {
|
||||
this.packetBuffer = packetBuffer;
|
||||
}
|
||||
|
||||
public StreamReceiver(Socket host, PriorityBlockingQueue packetBuffer){
|
||||
this.host=host;
|
||||
this.packetBuffer = packetBuffer;
|
||||
}
|
||||
|
||||
|
||||
public void connect(){
|
||||
try {
|
||||
stream = host.getInputStream();
|
||||
@@ -66,7 +73,6 @@ public class StreamReceiver {
|
||||
} catch (Exception e) {
|
||||
moreBytes = false;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,8 +106,8 @@ public class StreamReceiver {
|
||||
}
|
||||
|
||||
/**
|
||||
* takes an array of up to 7 bytes and returns a positive
|
||||
* long constructed from the input bytes
|
||||
* takes an array of up to 7 bytes in little endian format and
|
||||
* returns a positive long constructed from the input bytes
|
||||
*
|
||||
* @return a positive long if there is less than 7 bytes -1 otherwise
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user