Java API Tutorial - Java Socket(Proxy proxy) Constructor








Syntax

Socket(Proxy proxy) constructor from Socket has the following syntax.

public Socket(Proxy proxy)

Example

In the following code shows how to use Socket.Socket(Proxy proxy) constructor.

import java.net.Proxy;
import java.net.Socket;

public class Main {
  public static void main(String[] argv) throws Exception {
    Proxy proxy = Proxy.NO_PROXY;
    Socket socket = new Socket(proxy);
  }
}