AbstractConnection

Abstract base class for TCP connections.

abstract
class AbstractConnection : Connection {}

Constructors

this
this(int connectionId, TcpSslOptions options, TcpStream tcp)
Undocumented in source.
this
this(int connectionId, TcpSslOptions options, TcpStream tcp, Codec codec, NetConnectionHandler eventHandler)

Members

Functions

close
void close()
containsAttribute
bool containsAttribute(string key)

{@inheritDoc}

encode
void encode(Object message)
Undocumented in source. Be warned that the author may not have intended to support it.
getAttribute
Object getAttribute(string key)

{@inheritDoc}

getAttribute
Object getAttribute(string key, Object defaultValue)

{@inheritDoc}

getAttributeKeys
string[] getAttributeKeys()

{@inheritDoc}

getCodec
Codec getCodec()
Undocumented in source. Be warned that the author may not have intended to support it.
getHandler
NetConnectionHandler getHandler()
Undocumented in source. Be warned that the author may not have intended to support it.
getId
int getId()
Undocumented in source. Be warned that the author may not have intended to support it.
getOptions
TcpSslOptions getOptions()
Undocumented in source. Be warned that the author may not have intended to support it.
getState
ConnectionState getState()
Undocumented in source. Be warned that the author may not have intended to support it.
getStream
TcpStream getStream()
Undocumented in source. Be warned that the author may not have intended to support it.
isActive
bool isActive()
Undocumented in source. Be warned that the author may not have intended to support it.
isClosing
bool isClosing()
Undocumented in source. Be warned that the author may not have intended to support it.
isConnected
bool isConnected()
Undocumented in source. Be warned that the author may not have intended to support it.
isSecured
bool isSecured()
Undocumented in source. Be warned that the author may not have intended to support it.
notifyClose
void notifyClose()
Undocumented in source. Be warned that the author may not have intended to support it.
notifyException
void notifyException(Exception t)
Undocumented in source. Be warned that the author may not have intended to support it.
onDataReceived
DataHandleStatus onDataReceived(ByteBuffer buffer)
Undocumented in source. Be warned that the author may not have intended to support it.
removeAttribute
Object removeAttribute(string key)

{@inheritDoc}

removeAttribute
bool removeAttribute(string key, Object value)

{@inheritDoc}

replaceAttribute
bool replaceAttribute(string key, Object oldValue, Object newValue)

{@inheritDoc}

setAttribute
Object setAttribute(string key, Object value)

{@inheritDoc}

setAttribute
Object setAttribute(string key)

{@inheritDoc}

setAttributeIfAbsent
Object setAttributeIfAbsent(string key, Object value)

{@inheritDoc}

setAttributeIfAbsent
Object setAttributeIfAbsent(string key)

{@inheritDoc}

setCodec
AbstractConnection setCodec(Codec codec)
Undocumented in source. Be warned that the author may not have intended to support it.
setHandler
AbstractConnection setHandler(NetConnectionHandler handler)
setState
void setState(ConnectionState state)
toString
string toString()
Undocumented in source. Be warned that the author may not have intended to support it.
write
void write(const(ubyte)[] data)

/

write
void write(string str)

/

write
void write(ByteBuffer buffer)
Undocumented in source. Be warned that the author may not have intended to support it.
write
void write(ByteBuffer buffer, Callback callback)
Undocumented in source. Be warned that the author may not have intended to support it.
write
void write(ByteBuffer[] buffers, Callback callback)
Undocumented in source. Be warned that the author may not have intended to support it.
write
void write(Object message)
Undocumented in source. Be warned that the author may not have intended to support it.

Properties

localAddress
Address localAddress [@property getter]
remoteAddress
Address remoteAddress [@property getter]

/

Variables

_connectionId
int _connectionId;
Undocumented in source.
_connectionState
ConnectionState _connectionState;
Undocumented in source.
_dataReceivedHandler
DataReceivedHandler _dataReceivedHandler;
Undocumented in source.
_decoder
Decoder _decoder;
Undocumented in source.
_encoder
Encoder _encoder;
Undocumented in source.
_netHandler
NetConnectionHandler _netHandler;
Undocumented in source.
_options
TcpSslOptions _options;
Undocumented in source.
_tcp
TcpStream _tcp;
Undocumented in source.
attributes
Object[string] attributes;
Undocumented in source.

Inherited Members

From Connection

getStream
TcpStream getStream()
Undocumented in source.
getState
ConnectionState getState()
Undocumented in source.
setState
void setState(ConnectionState state)
Undocumented in source.
getHandler
NetConnectionHandler getHandler()

@return the EventHandler which handles this connection.

getAttribute
Object getAttribute(string key)

Returns the value of the user-defined attribute of this connection.

getAttribute
Object getAttribute(string key, Object defaultValue)

Returns the value of user defined attribute associated with the specified key. If there's no such attribute, the specified default value is associated with the specified key, and the default value is returned. This method is same with the following code except that the operation is performed atomically. <pre> if (containsAttribute(key)) { return getAttribute(key); } else { setAttribute(key, defaultValue); return defaultValue; } </pre>

setAttribute
Object setAttribute(string key, Object value)

Sets a user-defined attribute.

setAttribute
Object setAttribute(string key)

Sets a user defined attribute without a value. This is useful when you just want to put a 'mark' attribute. Its value is set to {@link bool#TRUE}.

setAttributeIfAbsent
Object setAttributeIfAbsent(string key, Object value)

Sets a user defined attribute if the attribute with the specified key is not set yet. This method is same with the following code except that the operation is performed atomically. <pre> if (containsAttribute(key)) { return getAttribute(key); } else { return setAttribute(key, value); } </pre>

setAttributeIfAbsent
Object setAttributeIfAbsent(string key)

Sets a user defined attribute without a value if the attribute with the specified key is not set yet. This is useful when you just want to put a 'mark' attribute. Its value is set to {@link bool#TRUE}. This method is same with the following code except that the operation is performed atomically. <pre> if (containsAttribute(key)) { return getAttribute(key); // might not always be bool.TRUE. } else { return setAttribute(key); } </pre>

removeAttribute
Object removeAttribute(string key)

Removes a user-defined attribute with the specified key.

removeAttribute
bool removeAttribute(string key, Object value)

Removes a user defined attribute with the specified key if the current attribute value is equal to the specified value. This method is same with the following code except that the operation is performed atomically. <pre> if (containsAttribute(key) &amp;&amp; getAttribute(key).equals(value)) { removeAttribute(key); return true; } else { return false; } </pre>

replaceAttribute
bool replaceAttribute(string key, Object oldValue, Object newValue)

Replaces a user defined attribute with the specified key if the value of the attribute is equals to the specified old value. This method is same with the following code except that the operation is performed atomically. <pre> if (containsAttribute(key) &amp;&amp; getAttribute(key).equals(oldValue)) { setAttribute(key, newValue); return true; } else { return false; } </pre>

containsAttribute
bool containsAttribute(string key)

@param key The key of the attribute we are looking for in the connection @return <tt>true</tt> if this connection contains the attribute with the specified <tt>key</tt>.

getAttributeKeys
string[] getAttributeKeys()

@return the set of keys of all user-defined attributes.

encode
void encode(Object message)
Undocumented in source.
write
void write(Object message)

Writes the specified <code>message</code> to remote peer. This operation is asynchronous; {@link IoHandler#messageSent(Connection,Object)} will be invoked when the message is actually sent to remote peer. You can also wait for the returned {@link WriteFuture} if you want to wait for the message actually written.

write
void write(const(ubyte)[] data)
Undocumented in source.
write
void write(string str)
Undocumented in source.
write
void write(ByteBuffer buffer)
Undocumented in source.
write
void write(ByteBuffer byteBuffer, Callback callback)
Undocumented in source.
getId
int getId()
Undocumented in source.
getOpenTime
long getOpenTime()
Undocumented in source.
getCloseTime
long getCloseTime()
Undocumented in source.
getDuration
long getDuration()
Undocumented in source.
getLastReadTime
long getLastReadTime()
Undocumented in source.
getLastWrittenTime
long getLastWrittenTime()
Undocumented in source.
getLastActiveTime
long getLastActiveTime()
Undocumented in source.
getReadBytes
size_t getReadBytes()
Undocumented in source.
getWrittenBytes
size_t getWrittenBytes()
Undocumented in source.
getIdleTimeout
long getIdleTimeout()
Undocumented in source.
toString
string toString()
Undocumented in source.
close
void close()
Undocumented in source.
shutdownOutput
void shutdownOutput()
Undocumented in source.
shutdownInput
void shutdownInput()
Undocumented in source.
isConnected
bool isConnected()

@return <tt>true</tt> if this connection is connected with remote peer.

isActive
bool isActive()

@return <tt>true</tt> if this connection is active.

isClosing
bool isClosing()

@return <tt>true</tt> if and only if this connection is being closed (but not disconnected yet) or is closed.

isSecured
bool isSecured()

@return <tt>true</tt> if the connection has started and initialized a SslEngine, <tt>false</tt> if the connection is not yet secured (the handshake is not completed) or if SSL is not set for this connection, or if SSL is not even an option.

isShutdownOutput
bool isShutdownOutput()
Undocumented in source.
isShutdownInput
bool isShutdownInput()
Undocumented in source.
isWaitingForClose
bool isWaitingForClose()
Undocumented in source.
getLocalAddress
Address getLocalAddress()
Undocumented in source.
getRemoteAddress
Address getRemoteAddress()
Undocumented in source.
getMaxIdleTimeout
Duration getMaxIdleTimeout()
Undocumented in source.

Meta