Top Description Methods
io.vertx.core.net.impl

public Interface NetSocketInternal

extends NetSocket
Known Direct Implementers
io.vertx.core.net.impl.NetSocketImpl
Imports
io.netty.channel.ChannelHandler, .ChannelHandlerContext, io.vertx.core.AsyncResult, .Future, .Handler, io.vertx.core.net.NetSocket

Extends to expose Netty interactions for reusing existing Netty codecs and benefit from the features io.vertx.core.net.NetServer and io.vertx.core.net.NetClient:
Author
Julien Viet

Method Summary

Modifier and TypeMethod and Description
public ChannelHandlerContext

Returns:

the channel handler context
channelHandlerContext
()

Returns the ChannelHandlerContext of the last handler (named handler) of the pipeline that delivers message to the application with the handler(Handler) and messageHandler(Handler).

public NetSocketInternal

Returns:

a reference to this, so the API can be used fluently
eventHandler
(Handler<Object>
the handler to set
handler
)

Set an handler to process pipeline user events.

public NetSocketInternal

Returns:

a reference to this, so the API can be used fluently
messageHandler
(Handler<Object>
the handler to set
handler
)

Set a handler on this socket to process the messages produced by this socket.

public Future<Void>

Returns:

a future completed with the result
writeMessage
(Object
the message to write, it should be handled by one of the channel pipeline handlers
message
)

Write a message in the channel pipeline.

public NetSocketInternal
writeMessage(Object message, Handler<AsyncResult<Void>> handler)

Like writeMessage(Object) but with an handler called when the message has been written or failed to be written.

Inherited from io.vertx.core.net.NetSocket:
applicationLayerProtocolcloseclosecloseHandlerdrainHandlerendendendHandlerexceptionHandlerfetchhandlerindicatedServerNameisSsllocalAddresslocalAddresspausepeerCertificateChainpeerCertificatesremoteAddressremoteAddressresumesendFilesendFilesendFilesendFilesendFilesendFilesetWriteQueueMaxSizesslSessionupgradeToSslupgradeToSslupgradeToSslupgradeToSslwritewritewritewritewritewriteHandlerID

Method Detail

channelHandlerContextback to summary
public ChannelHandlerContext channelHandlerContext()

Returns the ChannelHandlerContext of the last handler (named handler) of the pipeline that delivers message to the application with the handler(Handler) and messageHandler(Handler).

Handlers should be inserted in the pipeline using io.netty.channel.ChannelPipeline#addBefore(String, String, ChannelHandler):

  ChannelPipeline pipeline = so.channelHandlerContext().pipeline();
  pipeline.addBefore("handler", "myhandler", new MyHandler());
Returns:ChannelHandlerContext

the channel handler context

eventHandlerback to summary
public NetSocketInternal eventHandler(Handler<Object> handler)

Set an handler to process pipeline user events. The handler should take care of releasing event, e.g calling ReferenceCountUtil.release(evt).

Parameters
handler:Handler<Object>

the handler to set

Returns:NetSocketInternal

a reference to this, so the API can be used fluently

messageHandlerback to summary
public NetSocketInternal messageHandler(Handler<Object> handler)

Set a handler on this socket to process the messages produced by this socket. The message can be io.netty.buffer.ByteBuf or other messages produced by channel pipeline handlers.

The handler should take care of releasing pooled / direct messages.

The handler replaces any handler(Handler) previously set.

Parameters
handler:Handler<Object>

the handler to set

Returns:NetSocketInternal

a reference to this, so the API can be used fluently

writeMessageback to summary
public Future<Void> writeMessage(Object message)

Write a message in the channel pipeline.

When a read operation is in progress, the flush operation is delayed until the read operation completes.

Parameters
message:Object

the message to write, it should be handled by one of the channel pipeline handlers

Returns:Future<Void>

a future completed with the result

writeMessageback to summary
public NetSocketInternal writeMessage(Object message, Handler<AsyncResult<Void>> handler)

Like writeMessage(Object) but with an handler called when the message has been written or failed to be written.