Fixes #2282 - Fixing Fuzzer.

+ Client lifecycle now honored
+ Slow write now possible
This commit is contained in:
Joakim Erdfelt 2018-03-07 07:55:05 -06:00
parent dd57cf0bf6
commit bca53be4f4
3 changed files with 14 additions and 1 deletions

View File

@ -225,6 +225,8 @@ public class BlockheadClientRequest extends HttpRequest implements Response.Comp
endp,
client.getExecutor());
endp.setIdleTimeout(client.getIdleTimeout());
connection.setUpgradeResponseHeaders(response.getHeaders());
// Now swap out the connection

View File

@ -194,7 +194,7 @@ public class BlockheadConnection extends AbstractConnection implements Connectio
{
int len = Math.min(numBytes, buf.remaining());
ByteBuffer slice = buf.slice();
buf.position(len);
buf.limit(len);
try
{
getEndPoint().flush(slice);

View File

@ -84,6 +84,8 @@ public class Fuzzer implements AutoCloseable
client.setIdleTimeout(TimeUnit.SECONDS.toMillis(2));
client.start();
this.generator = testcase.getLaxGenerator();
this.testname = testcase.getTestMethodName();
}
@ -111,6 +113,14 @@ public class Fuzzer implements AutoCloseable
public void close()
{
this.clientConnection.close();
try
{
this.client.stop();
}
catch (Exception ignore)
{
LOG.ignore(ignore);
}
}
public void disconnect()
@ -121,6 +131,7 @@ public class Fuzzer implements AutoCloseable
public void connect() throws IOException
{
BlockheadClientRequest request = this.client.newWsRequest(testcase.getServerURI());
request.idleTimeout(2, TimeUnit.SECONDS);
request.header("X-TestCase", testname);
Future<BlockheadConnection> connFut = request.sendAsync();