java.io.Closeable, java.lang.AutoCloseable, Releasable, TcpChannelpublic final class MockTcpTransport.MockChannel extends java.lang.Object implements java.io.Closeable, TcpChannel
| Constructor | Description |
|---|---|
MockChannel(java.net.ServerSocket serverSocket,
java.lang.String profile) |
Constructs a new MockChannel instance intended for accepting requests.
|
MockChannel(java.net.Socket socket,
java.net.InetSocketAddress localAddress,
java.lang.String profile,
java.util.function.Consumer<MockTcpTransport.MockChannel> onClose) |
Constructs a new MockChannel instance intended for handling the actual incoming / outgoing traffic.
|
| Modifier and Type | Method | Description |
|---|---|---|
void |
accept(java.util.concurrent.Executor executor) |
|
void |
addCloseListener(ActionListener<java.lang.Void> listener) |
|
void |
close() |
|
void |
close0() |
|
java.net.InetSocketAddress |
getLocalAddress() |
|
boolean |
isOpen() |
|
void |
loopRead(java.util.concurrent.Executor executor) |
|
void |
sendMessage(BytesReference reference,
ActionListener<java.lang.Void> listener) |
|
void |
setSoLinger(int value) |
|
java.lang.String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic MockChannel(java.net.Socket socket,
java.net.InetSocketAddress localAddress,
java.lang.String profile,
java.util.function.Consumer<MockTcpTransport.MockChannel> onClose)
socket - The client socket. Mut not be null.localAddress - Address associated with the corresponding local server socket. Must not be null.profile - The associated profile name.onClose - Callback to execute when this channel is closed.public MockChannel(java.net.ServerSocket serverSocket,
java.lang.String profile)
serverSocket - The associated server socket. Must not be null.profile - The associated profile name.public void accept(java.util.concurrent.Executor executor)
throws java.io.IOException
java.io.IOExceptionpublic void loopRead(java.util.concurrent.Executor executor)
public void close0()
throws java.io.IOException
java.io.IOExceptionpublic java.lang.String toString()
toString in class java.lang.Objectpublic void close()
close in interface java.lang.AutoCloseableclose in interface java.io.Closeableclose in interface Releasableclose in interface TcpChannelpublic void addCloseListener(ActionListener<java.lang.Void> listener)
addCloseListener in interface TcpChannelpublic void setSoLinger(int value)
throws java.io.IOException
setSoLinger in interface TcpChanneljava.io.IOExceptionpublic boolean isOpen()
isOpen in interface TcpChannelpublic java.net.InetSocketAddress getLocalAddress()
getLocalAddress in interface TcpChannelpublic void sendMessage(BytesReference reference, ActionListener<java.lang.Void> listener)
sendMessage in interface TcpChannel