use of kg.apc.emulators.SocketChannelEmul in project jmeter-plugins by undera.
the class HTTPRawSamplerTest method testReadResponse.
/**
* Test of readResponse method, of class HTTPRawSampler.
*/
@Test
public void testReadResponse() throws Exception {
System.out.println("readResponse");
SocketChannelEmul sock = new SocketChannelEmul();
sock.setBytesToRead(ByteBuffer.wrap("test".getBytes()));
SampleResult res = new SampleResult();
res.sampleStart();
byte[] expResult = "test".getBytes();
byte[] result = instance.readResponse(sock, res);
assertEquals(expResult.length, result.length);
}
use of kg.apc.emulators.SocketChannelEmul in project jmeter-plugins by undera.
the class SocketChannelWithTimeoutsTest method testWrite_Empty.
@Test
public void testWrite_Empty() throws Exception {
System.out.println("write");
SocketChannelWithTimeoutsEmul instance = new SocketChannelWithTimeoutsEmul();
SocketChannelEmul sc = (SocketChannelEmul) instance.socketChannel;
assertEquals(4, instance.write(ByteBuffer.wrap("test".getBytes())));
Assert.assertEquals(4, sc.getWrittenBytesCount());
assertEquals(0, instance.write(ByteBuffer.wrap("".getBytes())));
Assert.assertEquals(0, sc.getWrittenBytesCount());
}
Aggregations