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