[4][5] The rebels continued to win victories and gain territories in the following month, taking most of the northern coast of Java as far west as Cirebon.
[9] Trunajaya had established his court in an old royal citadel (around the location of today's East Java Governor's office) and diverted the Kali Mas to form a moat around it.
[9] Trunajaya had established his main line of defence along the river north of the citadel, building elevated fortifications and palisade barriers, and emplacing two artillery batteries.
[2] The distance from the coast to Trunajaya's main defenses, around 4.5 kilometres (2.8 mi), mostly consisted of marshy ground covered with scrub, and was underwater at high tide.
[2] At this point, time appeared to be on Trunajaya's side, as further delay would allow him to strengthen his fortifications and reinforcements, while disease would weaken the VOC's forces.
[11] Two VOC detachments—Indonesian companies led by Dutch captains—were sent northwest along the coast, clearing the rebels in the areas surrounding Sidayu, Tuban and the Kendeng mountains with no losses.
[2] Several Madurese lords submitted to the admiral as the representative of the Mataram king in late May, and Speelman tried to install one of them, Raden Martapati, as a proxy.
[2] However, Martapati's authority collapsed in the face of Trunajaya loyalists as soon as his VOC escorts left Madura, and he was forced to flee to Surabaya.
[13] Upon receiving this news, Speelman decided to sail immediately to defend the strategic point of Jepara and link up with the retreating royal forces.
[15] Speelman planned to follow his victory with a further advance towards the interior of Java, but his campaign was cut short by the news of the Mataram capital's fall, after which he immediately sailed to defend Jepara.
[15] The defeated rebel forces retreated inland, driving closer to Mataram's capital and triggering an early attack on the court.