Package java.nio.channels

Examples of java.nio.channels.ServerSocketChannel.bind()


      server.configureBlocking(false);
      InetSocketAddress bind = new InetSocketAddress(MainHandler
          .getCurrentInstance().getProperty(BINKD_BIND, "0.0.0.0"),
          MainHandler.getCurrentInstance().getIntegerProperty(
              BINKD_PORT, 24554));
      server.bind(bind, 5);
      logger.l1("We are listening on " + bind.getHostString() + ":"
          + bind.getPort());
      Selector selector = Selector.open();
      server.register(selector, server.validOps());
      while (true) {
View Full Code Here


    @Test
    public void testReceiveDataBeforeReplyIsIllegal() throws Exception
    {
        ServerSocketChannel server = ServerSocketChannel.open();
        server.bind(new InetSocketAddress("localhost", 0));

        Session session = startClient(new InetSocketAddress("localhost", server.socket().getLocalPort()), null);
        session.syn(new SynInfo(new Fields(), true), null);

        SocketChannel channel = server.accept();
View Full Code Here

    @Test //TODO: throws an ISException in StandardStream.updateCloseState(). But instead we should send a rst or something to the server probably?!
    public void testServerClosesStreamTwice() throws Exception
    {
        ServerSocketChannel server = ServerSocketChannel.open();
        server.bind(new InetSocketAddress("localhost", 0));

        Session session = startClient(new InetSocketAddress("localhost", server.socket().getLocalPort()), null);
        final CountDownLatch dataLatch = new CountDownLatch(2);
        session.syn(new SynInfo(new Fields(), false), new StreamFrameListener.Adapter()
        {
View Full Code Here

    @Slow
    @Test
    public void testConnectTimeoutBeforeSuccessfulConnect() throws Exception
    {
        ServerSocketChannel server = ServerSocketChannel.open();
        server.bind(new InetSocketAddress("localhost", 0));
        SocketAddress address = server.getLocalAddress();

        final AtomicLong timeoutConnection = new AtomicLong();
        final long connectTimeout = 1000;
        SelectorManager selectorManager = new SelectorManager(executor, scheduler)
View Full Code Here

    //TODO: But according to the spec we probably should just ignore the data?!
    @Test
    public void testDataSentOnClosedStreamIsIgnored() throws Exception
    {
        ServerSocketChannel server = ServerSocketChannel.open();
        server.bind(new InetSocketAddress("localhost", 0));

        Session session = startClient(new InetSocketAddress("localhost", server.socket().getLocalPort()), null);
        final CountDownLatch dataLatch = new CountDownLatch(2);
        session.syn(new SynInfo(new Fields(), true), new StreamFrameListener.Adapter()
        {
View Full Code Here

32  195%
*/
public class ActiveSocketMain {
    public static void main(String... ignored) throws ExecutionException, InterruptedException, IOException {
        ServerSocketChannel ssc = ServerSocketChannel.open();
        ssc.bind(new InetSocketAddress(0));

        List<Callable<Integer>> runs = new ArrayList<Callable<Integer>>();
        for (int i = 0; i < 64; i++) {
            final SocketChannel s = SocketChannel.open(new InetSocketAddress("localhost", ssc.socket().getLocalPort()));
            final SocketChannel s2 = ssc.accept();
View Full Code Here

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.