private int connectImpl(InetAddress remote, int remotePort, int trafficClass) throws IOException {
   try {
     if (false) throw new cli.System.Net.Sockets.SocketException();
     if (false) throw new cli.System.ObjectDisposedException("");
     cli.System.Net.IPEndPoint ep =
         new cli.System.Net.IPEndPoint(
             PlainSocketImpl.getAddressFromInetAddress(remote), remotePort);
     if (isBlocking()) {
       fd.getSocket().Connect(ep);
       return 1;
     } else {
       asyncConnect = fd.getSocket().BeginConnect(ep, null, null);
       return IOStatus.UNAVAILABLE;
     }
   } catch (cli.System.Net.Sockets.SocketException x) {
     throw new ConnectException(x.getMessage());
   } catch (cli.System.ObjectDisposedException x1) {
     throw new SocketException("Socket is closed");
   }
 }