Package org.jgroups.nio
Class MockSocketChannel
- All Implemented Interfaces:
Closeable,AutoCloseable,ByteChannel,Channel,GatheringByteChannel,InterruptibleChannel,NetworkChannel,ReadableByteChannel,ScatteringByteChannel,WritableByteChannel
A mock
SocketChannel for testing- Since:
- 3.6.5
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ByteBufferprotected intprotected booleanprotected ByteBuffer -
Constructor Summary
ConstructorsConstructorDescriptionMockSocketChannel(SelectorProvider provider) Initializes a new instance of this class. -
Method Summary
Modifier and TypeMethodDescriptionbind(SocketAddress local) bytesToRead(byte[] buf) bytesToRead(ByteBuffer buf) bytesToWrite(int num) booleanconnect(SocketAddress remote) voiddoClose()boolean<T> TgetOption(SocketOption<T> name) protected voidprotected voidimplConfigureBlocking(boolean block) booleanbooleanintread(ByteBuffer dst) longread(ByteBuffer[] dsts, int offset, int length) recorder()recorder(ByteBuffer buf) <T> SocketChannelsetOption(SocketOption<T> name, T value) socket()Set<SocketOption<?>> intwrite(ByteBuffer buf) longwrite(ByteBuffer[] srcs, int offset, int length) Methods inherited from class java.nio.channels.SocketChannel
open, open, open, read, validOps, writeMethods inherited from class java.nio.channels.spi.AbstractSelectableChannel
blockingLock, configureBlocking, implCloseChannel, isBlocking, isRegistered, keyFor, provider, registerMethods inherited from class java.nio.channels.SelectableChannel
registerMethods inherited from class java.nio.channels.spi.AbstractInterruptibleChannel
begin, close, end, isOpen
-
Field Details
-
bytes_to_write
protected int bytes_to_write -
bytes_to_read
-
closed
protected boolean closed -
recorder
-
-
Constructor Details
-
MockSocketChannel
public MockSocketChannel() -
MockSocketChannel
Initializes a new instance of this class.- Parameters:
provider- The provider that created this channel
-
-
Method Details
-
bytesToWrite
-
bytesToRead
-
bytesToRead
-
bytesToRead
-
recorder
-
recorder
-
bind
- Specified by:
bindin interfaceNetworkChannel- Specified by:
bindin classSocketChannel- Throws:
IOException
-
doClose
public void doClose() -
setOption
- Specified by:
setOptionin interfaceNetworkChannel- Specified by:
setOptionin classSocketChannel- Throws:
IOException
-
getOption
- Throws:
IOException
-
supportedOptions
-
shutdownInput
- Specified by:
shutdownInputin classSocketChannel- Throws:
IOException
-
shutdownOutput
- Specified by:
shutdownOutputin classSocketChannel- Throws:
IOException
-
socket
- Specified by:
socketin classSocketChannel
-
isConnected
public boolean isConnected()- Specified by:
isConnectedin classSocketChannel
-
isConnectionPending
public boolean isConnectionPending()- Specified by:
isConnectionPendingin classSocketChannel
-
connect
- Specified by:
connectin classSocketChannel- Throws:
IOException
-
finishConnect
- Specified by:
finishConnectin classSocketChannel- Throws:
IOException
-
getRemoteAddress
- Specified by:
getRemoteAddressin classSocketChannel- Throws:
IOException
-
read
- Specified by:
readin interfaceReadableByteChannel- Specified by:
readin classSocketChannel- Throws:
IOException
-
read
- Specified by:
readin interfaceScatteringByteChannel- Specified by:
readin classSocketChannel- Throws:
IOException
-
write
- Specified by:
writein interfaceWritableByteChannel- Specified by:
writein classSocketChannel- Throws:
IOException
-
write
- Specified by:
writein interfaceGatheringByteChannel- Specified by:
writein classSocketChannel- Throws:
IOException
-
getLocalAddress
- Specified by:
getLocalAddressin interfaceNetworkChannel- Specified by:
getLocalAddressin classSocketChannel- Throws:
IOException
-
implCloseSelectableChannel
- Specified by:
implCloseSelectableChannelin classAbstractSelectableChannel- Throws:
IOException
-
implConfigureBlocking
- Specified by:
implConfigureBlockingin classAbstractSelectableChannel- Throws:
IOException
-