46 lines
1000 B
Java
46 lines
1000 B
Java
package com.flaremicro.crossjeeves.net.packet.test;
|
|
|
|
import java.io.DataInputStream;
|
|
import java.io.DataOutputStream;
|
|
import java.io.IOException;
|
|
|
|
import static org.junit.Assert.assertEquals;
|
|
|
|
import org.junit.After;
|
|
import org.junit.AfterClass;
|
|
import org.junit.Before;
|
|
|
|
import com.flaremicro.test.util.InOutBuffer;
|
|
|
|
public abstract class PacketTestBase {
|
|
|
|
private static InOutBuffer buffer = new InOutBuffer();
|
|
private static DataInputStream input = new DataInputStream(buffer.getInputStream());
|
|
private static DataOutputStream output = new DataOutputStream(buffer.getOutputStream());
|
|
|
|
@AfterClass
|
|
public static void cleanUp() throws IOException {
|
|
buffer.empty();
|
|
input.close();
|
|
output.close();
|
|
}
|
|
|
|
@Before
|
|
public void clearBuffer()
|
|
{
|
|
buffer.empty();
|
|
}
|
|
|
|
@After
|
|
public void assertBufferEmpty() {
|
|
assertEquals("Buffer should be empty:" ,0, buffer.size());
|
|
}
|
|
|
|
protected DataInputStream input() {
|
|
return input;
|
|
}
|
|
|
|
protected DataOutputStream output() {
|
|
return output;
|
|
}
|
|
} |