Class List Method List File List

# Class: Vertx::NetServer

Inherits:
  Object
  - Object
  - Vertx::NetServer
  show all
Includes:
  Measured
Defined in:
  /Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/net_server.rb

## Instance Method Summary (collapse)

- - (Object) actual_port
- - (Object) close
- - (Object) connect_handler
- - (Object) connect_stream
- - (NetServer) initialize(j_del) constructor
  A new instance of NetServer.
- - (Object) j_del
- - (Object) listen(port = nil, host = nil)
- - (Boolean) metrics_enabled?

## Constructor Details

### - (`NetServer`) initialize(j_del)

Returns a new instance of NetServer

    12
    13
    14
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/net_server.rb', line 12

    def initialize(j_del)
      @j_del = j_del
    end

## Instance Method Details

### - (`Object`) actual_port

Raises:

- (`ArgumentError`)

    90
    91
    92
    93
    94
    95
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/net_server.rb', line 90

    def actual_port
      if !block_given?
        return @j_del.java_method(:actualPort, []).call()
      end
      raise ArgumentError, "Invalid arguments when calling actual_port()"
    end

### - (`Object`) close

Raises:

- (`ArgumentError`)

    79
    80
    81
    82
    83
    84
    85
    86
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/net_server.rb', line 79

    def close
      if !block_given?
        return @j_del.java_method(:close, []).call()
      elsif block_given?
        return @j_del.java_method(:close, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |ar| yield(ar.failed ? ar.cause : nil) }))
      end
      raise ArgumentError, "Invalid arguments when calling close()"
    end

### - (`Object`) connect_handler

Raises:

- (`ArgumentError`)

    43
    44
    45
    46
    47
    48
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/net_server.rb', line 43

    def connect_handler
      if block_given?
        return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:connectHandler, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |event| yield(::Vertx::Util::Utils.safe_create(event,::Vertx::NetSocket)) })),::Vertx::NetServer)
      end
      raise ArgumentError, "Invalid arguments when calling connect_handler()"
    end

### - (`Object`) connect_stream

Raises:

- (`ArgumentError`)

    32
    33
    34
    35
    36
    37
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/net_server.rb', line 32

    def connect_stream
      if !block_given?
        return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:connectStream, []).call(),::Vertx::NetSocketStream)
      end
      raise ArgumentError, "Invalid arguments when calling connect_stream()"
    end

### - (`Object`) j_del

    17
    18
    19
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/net_server.rb', line 17

    def j_del
      @j_del
    end

### - (`Object`) listen(port = nil, host = nil)

Raises:

- (`ArgumentError`)

    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/net_server.rb', line 54

    def listen(port=nil,host=nil)
      if !block_given? && port == nil && host == nil
        @j_del.java_method(:listen, []).call()
        return self
      elsif block_given? && port == nil && host == nil
        @j_del.java_method(:listen, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::Vertx::NetServer) : nil) }))
        return self
      elsif port.class == Fixnum && !block_given? && host == nil
        @j_del.java_method(:listen, [Java::int.java_class]).call(port)
        return self
      elsif port.class == Fixnum && host.class == String && !block_given?
        @j_del.java_method(:listen, [Java::int.java_class,Java::java.lang.String.java_class]).call(port,host)
        return self
      elsif port.class == Fixnum && block_given? && host == nil
        @j_del.java_method(:listen, [Java::int.java_class,Java::IoVertxCore::Handler.java_class]).call(port,(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::Vertx::NetServer) : nil) }))
        return self
      elsif port.class == Fixnum && host.class == String && block_given?
        @j_del.java_method(:listen, [Java::int.java_class,Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(port,host,(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::Vertx::NetServer) : nil) }))
        return self
      end
      raise ArgumentError, "Invalid arguments when calling listen(port,host)"
    end

### - (`Boolean`) metrics_enabled?

Returns:

- (`Boolean`)

Raises:

- (`ArgumentError`)

    22
    23
    24
    25
    26
    27
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/net_server.rb', line 22

    def metrics_enabled?
      if !block_given?
        return @j_del.java_method(:isMetricsEnabled, []).call()
      end
      raise ArgumentError, "Invalid arguments when calling metrics_enabled?()"
    end