Code example for Socket

Methods: connect

    @Override public void connectSocket(Socket socket, InetSocketAddress address,
        int connectTimeout) throws IOException {
      try { 
        socket.connect(address, connectTimeout);
      } catch (SecurityException se) {
        // Before android 4.3, socket.connect could throw a SecurityException 
        // if opening a socket resulted in an EACCES error. 
        IOException ioException = new IOException("Exception in connect");
        throw ioException;
    @Override public void enableTlsExtensions(SSLSocket socket, String uriHost) {
      super.enableTlsExtensions(socket, uriHost);
      if (openSslSocketClass.isInstance(socket)) {
        // This is Android: use reflection on OpenSslSocketImpl. 
        try { 
          setUseSessionTickets.invoke(socket, true);
Connect your IDE to all the code out there  Get Codota for Java