The MTA will test the vending machines for two years. In some cases, the locations competing with subway storefronts like one at Union Square, are just beyond the turnstile. The machines will offer products such as travel-sized toiletries, ear buds, phone chargers and on-the-go snacks. The MTA is testing the machines as a response to a reduction in subway newsstands, the result in part of declining magazine and newspaper sales. A third of the 248 retail spaces in the subway system are shuttered — most of those closed outposts are newsstands. Many people hope that this will bring in more revenue for a struggling transit system.