use of java.nio.channels.ByteChannel in project spring-boot by spring-projects.
the class SocketTargetServerConnectionTests method readData.
@Test
public void readData() throws Exception {
this.server.willSend("hello".getBytes());
this.server.start();
ByteChannel channel = this.connection.open(DEFAULT_TIMEOUT);
ByteBuffer buffer = ByteBuffer.allocate(5);
channel.read(buffer);
assertThat(buffer.array()).isEqualTo("hello".getBytes());
}
Aggregations