org.jboss.remoting.transport.multiplex
Class SinglePortVirtualServerSocket

java.lang.Object
  extended byjava.net.ServerSocket
      extended byorg.jboss.remoting.transport.multiplex.SinglePortVirtualServerSocket

public class SinglePortVirtualServerSocket
extends java.net.ServerSocket

Copyright (c) 2005

Author:
Ron Sigal

Constructor Summary
SinglePortVirtualServerSocket()
           
SinglePortVirtualServerSocket(java.net.InetSocketAddress remoteAddress, java.net.InetSocketAddress localAddress)
          Create a new SinglePortVirtualServerSocket.
SinglePortVirtualServerSocket(int port)
          Create a new SinglePortVirtualServerSocket.
 
Method Summary
 java.net.Socket accept()
           
 void bind(java.net.SocketAddress socketAddress)
           
 void bind(java.net.SocketAddress socketAddress, int backlog)
           
 void close()
           
 void connect(java.net.SocketAddress socketAddress)
          Connects this socket to the server.
 void connect(java.net.SocketAddress socketAddress, int timeout)
          Connects this socket to the server with a specified timeout value.
 java.nio.channels.ServerSocketChannel getChannel()
           
 java.net.InetAddress getInetAddress()
           
 int getLocalPort()
           
 java.net.SocketAddress getLocalSocketAddress()
           
 java.net.InetAddress getRemoteAddress()
           
 boolean isBound()
           
 boolean isClosed()
           
 boolean isConnected()
          Returns the connected state of the socket.
 java.lang.String toString()
           
 
Methods inherited from class java.net.ServerSocket
getReceiveBufferSize, getReuseAddress, getSoTimeout, implAccept, setReceiveBufferSize, setReuseAddress, setSocketFactory, setSoTimeout
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SinglePortVirtualServerSocket

public SinglePortVirtualServerSocket()
                              throws java.io.IOException
Throws:
java.io.IOException

SinglePortVirtualServerSocket

public SinglePortVirtualServerSocket(int port)
                              throws java.io.IOException
Create a new SinglePortVirtualServerSocket.

Parameters:
port -
Throws:
java.io.IOException

SinglePortVirtualServerSocket

public SinglePortVirtualServerSocket(java.net.InetSocketAddress remoteAddress,
                                     java.net.InetSocketAddress localAddress)
                              throws java.io.IOException
Create a new SinglePortVirtualServerSocket.

Throws:
java.io.IOException
Method Detail

accept

public java.net.Socket accept()
                       throws java.io.IOException
Throws:
java.io.IOException

bind

public void bind(java.net.SocketAddress socketAddress)
          throws java.io.IOException
Throws:
java.io.IOException

bind

public void bind(java.net.SocketAddress socketAddress,
                 int backlog)
          throws java.io.IOException
Throws:
java.io.IOException

close

public void close()
           throws java.io.IOException
Throws:
java.io.IOException

getInetAddress

public java.net.InetAddress getInetAddress()

getLocalPort

public int getLocalPort()

getChannel

public java.nio.channels.ServerSocketChannel getChannel()

getLocalSocketAddress

public java.net.SocketAddress getLocalSocketAddress()

isBound

public boolean isBound()

isClosed

public boolean isClosed()

toString

public java.lang.String toString()

connect

public void connect(java.net.SocketAddress socketAddress)
             throws java.io.IOException
Connects this socket to the server.

Parameters:
socketAddress - the SocketAddress
Throws:
java.io.IOException - if an error occurs during the connection
java.lang.IllegalArgumentException - if endpoint is null or is a SocketAddress subclass not supported by this socket

connect

public void connect(java.net.SocketAddress socketAddress,
                    int timeout)
             throws java.io.IOException
Connects this socket to the server with a specified timeout value. A timeout of zero is interpreted as an infinite timeout. The connection will then block until established or an error occurs.

Parameters:
socketAddress - the SocketAddress
timeout - the timeout value to be used in milliseconds.
Throws:
java.io.IOException - if an error occurs during the connection
java.net.SocketTimeoutException - if timeout expires before connecting
java.lang.IllegalArgumentException - if endpoint is null or is a SocketAddress subclass not supported by this socket

isConnected

public boolean isConnected()
Returns the connected state of the socket.


getRemoteAddress

public java.net.InetAddress getRemoteAddress()


Copyright © 1998-2005 JBoss Inc . All Rights Reserved.