The American Revolutionary War was officially ended by the Treaty of Paris in 1783, which in principle fixed the borders between British North America (later, Lower Canada) and the United States. However, there was an ambiguity in the treaty that led to a disagreement about which part of the Connecticut River system was being mentioned. The result was a disputed territory in what is today New Hampshire, claimed by both the United States and by the British government of Canada. It might have stayed at that until some further clarification by treaty (which was several times attempted but never quite successful), but the area was inhabited, and eventually both governments began to press their claims, including the right to tax. As you can well imagine, the residents were considerably less than happy at being taxed twice for everything, so on July 9, 1832, they declared independence, calling themselves the Republic of Indian Stream ('Indian Stream' was one of the names for the area), and one of the residents, Luther Parker, wrote a constitution for the Republic. The constitution explicitly recognized that its existence was temporary, but insisted that the residents had fully sovereign authority until the dispute over the border was resolved to their satisfaction.
Naturally, this was satisfactory to neither Canadian nor American authorities. The sheriffs of Coos County, New Hampshire, continued to treat Indian Stream as part of their jurisdiction, to increasing conflict. Eventually the council of Indian Stream responded by sending a letter to the Attorney General of the United States, claiming that they were willing to be part of the United States, but they were not part of New Hampshire. The Attorney General replied that they were part of the United States because they were part of New Hampshire; this led to the residents trying to get help from Canada, who responded by arresting Luther Parker. Eventually, the sheriff of Coos County raised the militia and invaded in August 1835. The militia just marched in and eventually arrested anyone still giving a token resistance.
This ended the independent Republic of Indian Stream, but is not quite the end of the story. The deputy sheriff of Coos County in 1838 arrested a hardware-store owner for an unpaid debt; the owner ran to the Canadians and claimed that the deputy had arrested him on Canadian soil; the Canadians arrested the deputy; a bunch of pro-American locals raided the house of the British magistrate where the deputy was being kept and, after a scuffle, the deputy was freed and the magistrate taken prisoner. (He was released after his wounds from the scuffle were treated.) To keep the peace, New Hampshire invaded again; it eventually removed its troops, presumably to reduce tensions with the British, but on April 16, 1836, the residents of Indian Stream officially declared themselves part of New Hampshire.
But this, too, was not the end of the story. The British were not happy at any of the recent events and lodged an official complaint. Both Britain and the United States were reluctant to go to war over a chain of events that had begun with a hardware store owner not paying his debts, so definite actions were limited and most symbolic, but New Hampshire incorporated the town of Pittsburg, New Hampshire in 1840, including Indian Stream in it. Another border dispute ended up resolving the matter. Disputes over the border between New Brunswick and Maine led to what is usually called 'the Aroostook War' (sometimes also called the Pork and Beans War), which was a 'war' in a figurative sense -- both sides called up their militias but no direct military conflict occurred (although it came close when a bear attacked some lumberjacks and was shot by the Canadians; the nearby Americans at first thought the Canadians had fired at them, and fired a few volleys back; the Canadians retreated and that was the end of it). Daniel Webster and Alexander Baring (Baron Ashburton) came up with a compromise solution, which was consolidated in the Webster-Ashburton treaty of 1842; part of the compromise ended up being various concessions on each side in various other border disputes, including that of Indian Stream, which the British conceded to New Hampshire.