public class MockSocketChannel extends SocketChannel
SocketChannel for testing| Modifier and Type | Field and Description |
|---|---|
protected ByteBuffer |
bytes_to_read |
protected int |
bytes_to_write |
protected boolean |
closed |
protected ByteBuffer |
recorder |
| Constructor and Description |
|---|
MockSocketChannel() |
MockSocketChannel(SelectorProvider provider)
Initializes a new instance of this class.
|
blockingLock, configureBlocking, implCloseChannel, isBlocking, isRegistered, keyFor, provider, registerregisterbegin, close, end, isOpenprotected int bytes_to_write
protected ByteBuffer bytes_to_read
protected boolean closed
protected ByteBuffer recorder
public MockSocketChannel()
public MockSocketChannel(SelectorProvider provider)
provider - The provider that created this channelpublic MockSocketChannel bytesToWrite(int num)
public MockSocketChannel bytesToRead(byte[] buf)
public MockSocketChannel bytesToRead(ByteBuffer buf)
public ByteBuffer bytesToRead()
public MockSocketChannel recorder(ByteBuffer buf)
public ByteBuffer recorder()
public SocketChannel bind(SocketAddress local) throws IOException
bind in interface NetworkChannelbind in class SocketChannelIOExceptionpublic void doClose()
public <T> SocketChannel setOption(SocketOption<T> name, T value) throws IOException
setOption in interface NetworkChannelsetOption in class SocketChannelIOExceptionpublic <T> T getOption(SocketOption<T> name) throws IOException
IOExceptionpublic Set<SocketOption<?>> supportedOptions()
public SocketChannel shutdownInput() throws IOException
shutdownInput in class SocketChannelIOExceptionpublic SocketChannel shutdownOutput() throws IOException
shutdownOutput in class SocketChannelIOExceptionpublic Socket socket()
socket in class SocketChannelpublic boolean isConnected()
isConnected in class SocketChannelpublic boolean isConnectionPending()
isConnectionPending in class SocketChannelpublic boolean connect(SocketAddress remote) throws IOException
connect in class SocketChannelIOExceptionpublic boolean finishConnect()
throws IOException
finishConnect in class SocketChannelIOExceptionpublic SocketAddress getRemoteAddress() throws IOException
getRemoteAddress in class SocketChannelIOExceptionpublic int read(ByteBuffer dst) throws IOException
read in interface ReadableByteChannelread in class SocketChannelIOExceptionpublic long read(ByteBuffer[] dsts, int offset, int length) throws IOException
read in interface ScatteringByteChannelread in class SocketChannelIOExceptionpublic int write(ByteBuffer buf) throws IOException
write in interface WritableByteChannelwrite in class SocketChannelIOExceptionpublic long write(ByteBuffer[] srcs, int offset, int length) throws IOException
write in interface GatheringByteChannelwrite in class SocketChannelIOExceptionpublic SocketAddress getLocalAddress() throws IOException
getLocalAddress in interface NetworkChannelgetLocalAddress in class SocketChannelIOExceptionprotected void implCloseSelectableChannel()
throws IOException
implCloseSelectableChannel in class AbstractSelectableChannelIOExceptionprotected void implConfigureBlocking(boolean block)
throws IOException
implConfigureBlocking in class AbstractSelectableChannelIOExceptionCopyright © 2025 JBoss, a division of Red Hat. All rights reserved.