code: public void setSoLinger(boolean on, int linger) throws SocketException {
          if (mSocket != null) {
              mSocket.setSoLinger(on, linger);
          }
          else {
              Object value;
              if (on) {
                  value = new Integer(linger);
              }
              else {
                  value = Boolean.FALSE;
              }
              setOption(1, value);
          }
      }
docs: Option 1.