Ejemplo n.º 1
0
 @Test
 public void testCompactProtocolClient() throws Exception {
   // Server and client use compact protocol
   try (ScopedServer server = new ScopedServer(new TCompactProtocol.Factory());
       ThriftClientManager manager = new ThriftClientManager();
       Scribe client = createScribeClient(manager, server, new TCompactProtocol.Factory())) {
     client.log(
         ImmutableList.of(
             new LogEntry("testCategory1", "testMessage1"),
             new LogEntry("testCategory2", "testMessage2")));
   }
 }
Ejemplo n.º 2
0
 @Test(expectedExceptions = {TTransportException.class})
 public void testUnmatchedProtocols() throws Exception {
   // Setup a server to accept compact protocol, and try to send it a message with a binary
   // protocol client. Server should disconnect the client while client is trying to read the
   // response, so we should get a TTransportException
   try (ScopedServer server = new ScopedServer(new TCompactProtocol.Factory());
       ThriftClientManager manager = new ThriftClientManager();
       Scribe client = createScribeClient(manager, server, new TBinaryProtocol.Factory())) {
     client.log(
         ImmutableList.of(
             new LogEntry("testCategory1", "testMessage1"),
             new LogEntry("testCategory2", "testMessage2")));
   }
 }