Code example for Charset

Methods: sleepencode

		when(mockFactory.createClient(HOSTNAME, PORT)).thenReturn(mockClient);
		// Set message on the queue 
			.thenReturn(new Job(utf8.encode(MESSAGE_ONE), utf8.encode(ID_ONE)))
			.thenReturn(new Job(utf8.encode(MESSAGE_TWO), utf8.encode(ID_TWO)))
			.thenThrow(new EmptyPool()); 
		LoggingTextConsumer consumer = new LoggingTextConsumer(HOSTNAME, PORT, POOL);
		// Run as background thread then tell to stop after processing documents. 
		Thread t = new Thread(consumer);
		Thread.sleep(10); // Could in case this if it starts to be a problem.
		// Check it gets messages 
		assertEquals(2, consumer.count);
		assertEquals(Arrays.asList(MESSAGE_ONE, MESSAGE_TWO), consumer.messages);
		verify(mockClient).purge(POOL, utf8.encode(ID_ONE));
		verify(mockClient).purge(POOL, utf8.encode(ID_TWO));
Stop searching for code, let great code find you!  Add Codota to your java IDE