@JSFunction public static Object shutdown(Context cx, Scriptable thisObj, Object[] args, Function func) { TCPImpl tcp = (TCPImpl) thisObj; clearErrno(); QueuedWrite qw = (QueuedWrite) cx.newObject(thisObj, QueuedWrite.CLASS_NAME); qw.shutdown = true; tcp.offerWrite(qw, cx); return qw; }