Former FBI Director James Comey said on Sunday that he has reached a deal with House Republicans to testify at a closed-door hearing this week about the agency’s actions during the 2016 presidential election.

“Grateful for a fair hearing from judge. Hard to protect my rights without being in contempt, which I don’t believe in. So will sit in the dark, but Republicans agree I’m free to talk when done and transcript released in 24 hours,” Comey tweeted from his account. “This is the closest I can get to public testimony.”

Comey challenged a subpoena issued by Rep. Bob Goodlatte, the Republican head of the House Judiciary Committee, to appear before the panel.

The former G-man said he would voluntarily testify, but wanted to do so during an open hearing so his answers couldn’t be taken out of context.

Lawyers for both sides argued in federal court on Friday with the judge saying he would make a decision by Monday.

Republicans want to grill Comey on his oversight of the investigation into Hillary Clinton’s use of an email server when she was secretary of state and Russian meddling in the election.

President Trump fired Comey in May 2017, leading to the appointment of special counsel Robert Mueller a week later.