Code example for Socket

Methods: bind, connect

0
 
    return new Socket(proxy);
  } 
 
  /* @inheritDoc */ 
  @Override 
  public Socket createSocket(InetAddress addr, int port) throws IOException {
 
    Socket socket = createSocket();
    socket.connect(new InetSocketAddress(addr, port));
    return socket;
  } 
 
  /* @inheritDoc */ 
  @Override 
  public Socket createSocket(InetAddress addr, int port,
      InetAddress localHostAddr, int localPort) throws IOException {
 
    Socket socket = createSocket();
    socket.bind(new InetSocketAddress(localHostAddr, localPort));
    socket.connect(new InetSocketAddress(addr, port));
    return socket;
  } 
 
  /* @inheritDoc */ 
  @Override 
  public Socket createSocket(String host, int port) throws IOException,
      UnknownHostException { 
 
    Socket socket = createSocket();