G CODE, DO NOT USE IT final Stream stream = ...; stream.data(StringDataInfo("chunk1", false), 5, TimeUnit.SECONDS, new Handler<Void>() { ... }); stream.data(StringDataInfo("chunk2", true), 1, TimeUnit.SECONDS, new Handler<Void>() { ... });
where the second call to {@link #data(DataInfo,Callback)} has a timeout smaller than the previous call.
The behavior of such style of invocations is unspecified (it may even throw an exception - similar to {@link WritePendingException}).
The correct sending of data frames is the following:
final Stream stream = ...; ... // Blocking version stream.data(new StringDataInfo("chunk1", false)).get(1, TimeUnit.SECONDS); stream.data(new StringDataInfo("chunk2", true)).get(1, TimeUnit.SECONDS); // Asynchronous version stream.data(new StringDataInfo("chunk1", false), 1, TimeUnit.SECONDS, new Handler.Adapter<Void>() { public void completed(Void context) { stream.data(new StringDataInfo("chunk2", true)); } });
@see StreamFrameListener