public class EmbeddedChannel extends AbstractChannel
Channel implementations that are used in an embedded fashion.AbstractChannel.AbstractUnsafeChannel.Unsafe| Constructor and Description |
|---|
EmbeddedChannel(ChannelHandler... handlers)
Create a new instance
|
| Modifier and Type | Method and Description |
|---|---|
void |
checkException()
Check if there was any
Throwable received and if so rethrow it. |
ChannelConfig |
config()
Returns the configuration of this channel.
|
protected void |
doBeginRead()
Schedule a read operation.
|
protected void |
doBind(SocketAddress localAddress)
Bind the
Channel to the SocketAddress |
protected void |
doClose()
Close the
Channel |
protected Runnable |
doDeregister()
|
protected void |
doDisconnect()
Disconnect this
Channel from its remote peer |
protected Runnable |
doRegister()
|
protected int |
doWrite(MessageList<Object> msgs,
int index)
Flush the content of the given
ByteBuf to the remote peer. |
protected void |
ensureOpen() |
boolean |
finish()
Mark this
Channel as finished. |
boolean |
isActive()
Return
true if the Channel is active and so connected. |
protected boolean |
isCompatible(EventLoop loop)
Return
true if the given EventLoop is compatible with this instance. |
protected boolean |
isFlushPending()
Return
true if a flush to the Channel is currently pending. |
boolean |
isOpen()
Returns
true if the Channel is open an may get active later |
Queue<Object> |
lastInboundBuffer()
|
Queue<Object> |
lastOutboundBuffer()
|
protected SocketAddress |
localAddress0()
Returns the
SocketAddress which is bound locally. |
ChannelMetadata |
metadata()
|
protected AbstractChannel.AbstractUnsafe |
newUnsafe()
Create a new
AbstractChannel.AbstractUnsafe instance which will be used for the life-time of the Channel |
Object |
readInbound()
Return received data from this
Channel |
Object |
readOutbound()
Read data froum the outbound.
|
protected SocketAddress |
remoteAddress0()
Return the
SocketAddress which the Channel is connected to. |
void |
runPendingTasks()
|
boolean |
writeInbound(Object... msgs)
Write messages to the inbound of this
Channel. |
boolean |
writeOutbound(Object... msgs)
Write messages to the outbound of this
Channel. |
alloc, bind, bind, calculateMessageSize, checkEOF, close, close, closeFuture, compareTo, connect, connect, connect, connect, deregister, deregister, disconnect, disconnect, doPreClose, equals, eventLoop, hashCode, id, invalidateLocalAddress, invalidateRemoteAddress, isRegistered, isWritable, localAddress, newFailedFuture, newProgressivePromise, newPromise, newSucceededFuture, parent, pipeline, read, remoteAddress, toString, unsafe, voidPromise, write, write, write, writepublic EmbeddedChannel(ChannelHandler... handlers)
handlers - the @link ChannelHandler}s which will be add in the ChannelPipelinepublic ChannelMetadata metadata()
Channelpublic ChannelConfig config()
Channelpublic boolean isOpen()
Channeltrue if the Channel is open an may get active laterpublic boolean isActive()
Channeltrue if the Channel is active and so connected.public Object readOutbound()
null if nothing is readable.public boolean writeInbound(Object... msgs)
Channel.msgs - the messages to be writtentrue if the write operation did add something to the the inbound bufferpublic boolean writeOutbound(Object... msgs)
Channel.msgs - the messages to be writtentrue if the write operation did add something to the the outbound bufferpublic boolean finish()
Channel as finished. Any futher try to write data to it will fail.true if any of the used buffers has something left to readpublic void runPendingTasks()
public void checkException()
Throwable received and if so rethrow it.protected final void ensureOpen()
protected boolean isCompatible(EventLoop loop)
AbstractChanneltrue if the given EventLoop is compatible with this instance.isCompatible in class AbstractChannelprotected SocketAddress localAddress0()
AbstractChannelSocketAddress which is bound locally.localAddress0 in class AbstractChannelprotected SocketAddress remoteAddress0()
AbstractChannelSocketAddress which the Channel is connected to.remoteAddress0 in class AbstractChannelprotected Runnable doRegister() throws Exception
AbstractChannelChannel is registered with its EventLoop as part of the register process.
You can return a Runnable which will be run as post-task of the registration process.
Sub-classes may override this method as it will just return nulldoRegister in class AbstractChannelExceptionprotected void doBind(SocketAddress localAddress) throws Exception
AbstractChannelChannel to the SocketAddressdoBind in class AbstractChannelExceptionprotected void doDisconnect()
throws Exception
AbstractChannelChannel from its remote peerdoDisconnect in class AbstractChannelExceptionprotected void doClose()
throws Exception
AbstractChannelChanneldoClose in class AbstractChannelExceptionprotected Runnable doDeregister() throws Exception
AbstractChannelChannel from its EventLoop.
You can return a Runnable which will be run as post-task of the registration process.
Sub-classes may override this methoddoDeregister in class AbstractChannelExceptionprotected void doBeginRead()
throws Exception
AbstractChanneldoBeginRead in class AbstractChannelExceptionprotected AbstractChannel.AbstractUnsafe newUnsafe()
AbstractChannelAbstractChannel.AbstractUnsafe instance which will be used for the life-time of the ChannelnewUnsafe in class AbstractChannelprotected boolean isFlushPending()
AbstractChanneltrue if a flush to the Channel is currently pending.isFlushPending in class AbstractChannelprotected int doWrite(MessageList<Object> msgs, int index) throws Exception
AbstractChannelByteBuf to the remote peer.
Sub-classes may override this as this implementation will just thrown an UnsupportedOperationExceptiondoWrite in class AbstractChannelExceptionCopyright © 2008-2013 The Netty Project. All Rights Reserved.