Class PlainSocket
java.lang.Object
io.helidon.common.socket.PlainSocket
- All Implemented Interfaces:
HelidonSocket, SocketContext, Supplier<byte[]>
- Direct Known Subclasses:
TlsSocket
Helidon socket that is based on plaintext.
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedPlainSocket(Socket delegate, String childSocketId, String socketId) Plain socket. -
Method Summary
Modifier and TypeMethodDescriptionChild socket id.static PlainSocketCreate a new client socket.voidclose()Close the underlying socket.byte[]get()voididle()Sets the socket to idle mode.booleanCheck if socket is connected.booleanisSecure()Whether the request is secure.Local peer information.Remote peer information.static PlainSocketCreate a new server socket.socketId()Main socket id.voidwrite(BufferData buffer) Write teh buffer to the underlying socket.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface HelidonSocket
protocol, protocolNegotiatedMethods inherited from interface SocketContext
log, logModifier and TypeMethodDescriptiondefault voidlog(System.Logger logger, System.Logger.Level level, String format, Object... variables) Log a message with the currentSocketContext.socketId()andSocketContext.childSocketId()to have consistent logs mappable to sockets.default voidlog(System.Logger logger, System.Logger.Level level, String format, Throwable t, Object... variables) Log a message with the currentSocketContext.socketId()andSocketContext.childSocketId()to have consistent logs mappable to sockets.
-
Constructor Details
-
PlainSocket
-
-
Method Details
-
server
Create a new server socket.- Parameters:
delegate- underlying socketchannelId- channel idserverChannelId- server channel id- Returns:
- a new plain socket
-
client
Create a new client socket.- Parameters:
delegate- underlying socketchannelId- channel id- Returns:
- a new plain socket
-
remotePeer
Description copied from interface:SocketContextRemote peer information.- Specified by:
remotePeerin interfaceSocketContext- Returns:
- peer info
-
localPeer
Description copied from interface:SocketContextLocal peer information.- Specified by:
localPeerin interfaceSocketContext- Returns:
- peer info
-
isSecure
public boolean isSecure()Description copied from interface:SocketContextWhether the request is secure.- Specified by:
isSecurein interfaceSocketContext- Returns:
- whether secure
-
socketId
Description copied from interface:SocketContextMain socket id. This is the server socket id for server side, connection id for client side.- Specified by:
socketIdin interfaceSocketContext- Returns:
- socket id
-
childSocketId
Description copied from interface:SocketContextChild socket id. This is the connection socket id for server side. For client side, this may be additional identification of a request (pipeline id, stream id).- Specified by:
childSocketIdin interfaceSocketContext- Returns:
- child socket id, never null
-
close
public void close()Description copied from interface:HelidonSocketClose the underlying socket.- Specified by:
closein interfaceHelidonSocket
-
idle
public void idle()Description copied from interface:HelidonSocketSets the socket to idle mode. Idle mode expects no bytes coming over the socket but keeps reading exactly one byte in case connection is severed. Idle mode should be used in case of client side connection caching.- Specified by:
idlein interfaceHelidonSocket
-
isConnected
public boolean isConnected()Description copied from interface:HelidonSocketCheck if socket is connected.- Specified by:
isConnectedin interfaceHelidonSocket- Returns:
- true if connected
-
write
Description copied from interface:HelidonSocketWrite teh buffer to the underlying socket. This method blocks until all bytes are written.- Specified by:
writein interfaceHelidonSocket- Parameters:
buffer- buffer to write
-
get
-