Package com.barchart.udt.nio

Source Code of com.barchart.udt.nio.TestSocketChannelUDT

package com.barchart.udt.nio;

import static org.junit.Assert.*;

import org.junit.Test;

import com.barchart.udt.SocketUDT;
import com.barchart.udt.TypeUDT;

public class TestSocketChannelUDT {

  @Test
  public void blocking() throws Exception {

    final SelectorProviderUDT provider = SelectorProviderUDT.DATAGRAM;
    final SocketUDT socket = new SocketUDT(TypeUDT.DATAGRAM);
    final SocketChannelUDT channel = new SocketChannelUDT(provider, socket);

    assertTrue(socket.isOpen());
    assertTrue(channel.isOpen());

    assertTrue(socket.isBlocking());
    assertTrue(channel.isBlocking());

    channel.configureBlocking(false);

    assertFalse(socket.isBlocking());
    assertFalse(channel.isBlocking());

    channel.close();

    assertFalse(socket.isOpen());
    assertFalse(channel.isOpen());

  }

}
TOP

Related Classes of com.barchart.udt.nio.TestSocketChannelUDT

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.