code: public static OutputStream getOutputStream(Socket socket, long timeout) 
        throws IOException {
      return (socket.getChannel() == null) ? 
          socket.getOutputStream() : new SocketOutputStream(socket, timeout);            
    }
docs: Returns OutputStream for the socket. If the socket has an associated
  SocketChannel then it returns a
  {@link SocketOutputStream} with the given timeout. If the socket does not
  have a channel, {@link Socket#getOutputStream()} is returned. In the later
  case, the timeout argument is ignored and the write will wait until
  data is available.<br><br>
  
  Any socket created using socket factories returned by {@link #NetUtils},
  must use this interface instead of {@link Socket#getOutputStream()}.
  
  @see Socket#getChannel()
  
  @param socket
  @param timeout timeout in milliseconds. This may not always apply. zero
  for waiting as long as necessary.
  @return OutputStream for writing to the socket.
  @throws IOException