On 1 May 1747, Bach met Friedrich II, King of Prussia, in the Potsdam city palace (where chamber music was usually played from 7-9pm daily). Johann Forkel recalled: in 1802
The king used to have every evening a private concert, in which he himself generally performed some concertos on the flute. One evening, just as he was getting his flute ready and his musicians were assembled, an officer brought him the written list of the strangers who had arrived. With his flute in his hand, he ran over the list, but immediately turned to the assembled musicians and said, with a kind of agitation: “Gentlemen, old Bach is come.” The flute was now laid aside; and old Bach, who had alighted at his son’s lodgings, was immediately summoned to the Palace.
… The King gave up his concert for this evening and invited Bach … to try his fortepianos, made by Silbermann, which stood in several rooms of the Palace. The musicians went with him from room to room, and Bach was invited to try them and to play unpremeditated compositions. After he had gone on for some time, he asked the King to give him the subject for a fugue in order to execute it immediately without any preparation. The King admired the learned manner in which his subject was thus executed extempore; and, probably, to see how far such art could be carried, expressed a wish to hear also a fugue with six obbligato parts. But as not every subject is fit for such full harmony, Bach chose one himself and immediately executed it to the astonishment of all present in the same magnificent and learned manner as he had done that of the King.
Cited in: Wolff, Christoph (2000) Johann Sebastian Bach: The Learned Musician. New York: Norton, p.427.