Class TestNettyStreamHandler
java.lang.Object
org.apache.kafka.common.network.netty.TestNettyStreamHandler
- All Implemented Interfaces:
AutoCloseable, org.apache.kafka.common.network.netty.NettyStream.StreamHandler
public class TestNettyStreamHandler
extends Object
implements org.apache.kafka.common.network.netty.NettyStream.StreamHandler, AutoCloseable
Listener to process the data received from the server. On the client side, the
client controls sending the data, however the data is received as a callback from
the Netty pipeline. This class is hooked into that callback to get the data.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()booleanvoidvoidhandleData(io.netty.buffer.ByteBuf data) voidvoidbooleanisClosed()booleanbooleanio.netty.buffer.ByteBufvoidSet a flag indicating that the class should throw exception when data is received.Methods inherited from class Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.kafka.common.network.netty.NettyStream.StreamHandler
canHandleUserEvent, handleHeaders, handleUserEvent
-
Constructor Details
-
TestNettyStreamHandler
-
-
Method Details
-
receivedData
public io.netty.buffer.ByteBuf receivedData() -
isStreamChannelClosed
public boolean isStreamChannelClosed() -
isClosed
public boolean isClosed() -
exceptionHandlerInvoked
public boolean exceptionHandlerInvoked() -
isWritabilityChangedEventInvoked
public boolean isWritabilityChangedEventInvoked() -
close
public void close()- Specified by:
closein interfaceAutoCloseable
-
handleData
public void handleData(io.netty.buffer.ByteBuf data) - Specified by:
handleDatain interfaceorg.apache.kafka.common.network.netty.NettyStream.StreamHandler
-
handleReadyForSend
public void handleReadyForSend()- Specified by:
handleReadyForSendin interfaceorg.apache.kafka.common.network.netty.NettyStream.StreamHandler
-
handleException
- Specified by:
handleExceptionin interfaceorg.apache.kafka.common.network.netty.NettyStream.StreamHandler
-
handleClose
public void handleClose()- Specified by:
handleClosein interfaceorg.apache.kafka.common.network.netty.NettyStream.StreamHandler
-
throwOnDataReceived
public void throwOnDataReceived()Set a flag indicating that the class should throw exception when data is received. This is to test that exception handler is invoked correctly on this class.
-