public class MockSocketChannel extends SocketChannel
SocketChannel
for testingModifier 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, register
register
begin, close, end, isOpen
protected 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 NetworkChannel
bind
in class SocketChannel
IOException
public void doClose()
public <T> SocketChannel setOption(SocketOption<T> name, T value) throws IOException
setOption
in interface NetworkChannel
setOption
in class SocketChannel
IOException
public <T> T getOption(SocketOption<T> name) throws IOException
IOException
public Set<SocketOption<?>> supportedOptions()
public SocketChannel shutdownInput() throws IOException
shutdownInput
in class SocketChannel
IOException
public SocketChannel shutdownOutput() throws IOException
shutdownOutput
in class SocketChannel
IOException
public Socket socket()
socket
in class SocketChannel
public boolean isConnected()
isConnected
in class SocketChannel
public boolean isConnectionPending()
isConnectionPending
in class SocketChannel
public boolean connect(SocketAddress remote) throws IOException
connect
in class SocketChannel
IOException
public boolean finishConnect() throws IOException
finishConnect
in class SocketChannel
IOException
public SocketAddress getRemoteAddress() throws IOException
getRemoteAddress
in class SocketChannel
IOException
public int read(ByteBuffer dst) throws IOException
read
in interface ReadableByteChannel
read
in class SocketChannel
IOException
public long read(ByteBuffer[] dsts, int offset, int length) throws IOException
read
in interface ScatteringByteChannel
read
in class SocketChannel
IOException
public int write(ByteBuffer buf) throws IOException
write
in interface WritableByteChannel
write
in class SocketChannel
IOException
public long write(ByteBuffer[] srcs, int offset, int length) throws IOException
write
in interface GatheringByteChannel
write
in class SocketChannel
IOException
public SocketAddress getLocalAddress() throws IOException
getLocalAddress
in interface NetworkChannel
getLocalAddress
in class SocketChannel
IOException
protected void implCloseSelectableChannel() throws IOException
implCloseSelectableChannel
in class AbstractSelectableChannel
IOException
protected void implConfigureBlocking(boolean block) throws IOException
implConfigureBlocking
in class AbstractSelectableChannel
IOException
Copyright © 2018 JBoss, a division of Red Hat. All rights reserved.