use of org.apache.thrift.transport.TTransport in project alluxio by Alluxio.
the class TransportProviderTest method simpleAuthenticationEmptyUser.
/**
* In SIMPLE mode, if client's username is empty, an exception should be thrown in server side.
*/
@Test
public void simpleAuthenticationEmptyUser() throws Exception {
Configuration.set(PropertyKey.SECURITY_AUTHENTICATION_TYPE, AuthType.SIMPLE.getAuthName());
mTransportProvider = TransportProvider.Factory.create();
// start server
startServerThread();
// check case that user is empty
mThrown.expect(TTransportException.class);
mThrown.expectMessage("Peer indicated failure: Plain authentication failed: No authentication" + " identity provided");
TTransport client = ((PlainSaslTransportProvider) mTransportProvider).getClientTransport("", "whatever", mServerAddress);
try {
client.open();
} finally {
mServer.stop();
}
}
use of org.apache.thrift.transport.TTransport in project alluxio by Alluxio.
the class TransportProviderTest method simpleAuthentication.
/**
* In SIMPLE mode, the TTransport mechanism is PLAIN. When server authenticate the connected
* client user, it use {@link SimpleAuthenticationProvider}.
*/
@Test
public void simpleAuthentication() throws Exception {
Configuration.set(PropertyKey.SECURITY_AUTHENTICATION_TYPE, AuthType.SIMPLE.getAuthName());
mTransportProvider = TransportProvider.Factory.create();
// start server
startServerThread();
// when connecting, authentication happens. It is a no-op in Simple mode.
TTransport client = mTransportProvider.getClientTransport(mServerAddress);
client.open();
Assert.assertTrue(client.isOpen());
// clean up
client.close();
mServer.stop();
}
use of org.apache.thrift.transport.TTransport in project alluxio by Alluxio.
the class TransportProviderTest method simpleAuthenticationEmptyPassword.
/**
* In SIMPLE mode, if client's password is empty, an exception should be thrown in server side.
* Although password is actually not used and we do not really authenticate the user in SIMPLE
* mode, we need the Plain SASL server has ability to check empty password.
*/
@Test
public void simpleAuthenticationEmptyPassword() throws Exception {
Configuration.set(PropertyKey.SECURITY_AUTHENTICATION_TYPE, AuthType.SIMPLE.getAuthName());
mTransportProvider = TransportProvider.Factory.create();
// start server
startServerThread();
// check case that password is empty
mThrown.expect(TTransportException.class);
mThrown.expectMessage("Peer indicated failure: Plain authentication failed: No password " + "provided");
TTransport client = ((PlainSaslTransportProvider) mTransportProvider).getClientTransport("anyone", "", mServerAddress);
try {
client.open();
} finally {
mServer.stop();
}
}
use of org.apache.thrift.transport.TTransport in project metacat by Netflix.
the class HiveMetastoreClientFactory method createRawTransport.
protected TTransport createRawTransport(final String host, final int port) throws TTransportException {
if (socksProxy == null) {
final TTransport transport = new TSocket(host, port, timeoutMillis);
try {
transport.open();
return transport;
} catch (Throwable t) {
transport.close();
throw t;
}
}
final Socket socks = createSocksSocket(socksProxy);
try {
try {
socks.connect(InetSocketAddress.createUnresolved(host, port), timeoutMillis);
socks.setSoTimeout(timeoutMillis);
return new TSocket(socks);
} catch (Throwable t) {
closeQuietly(socks);
throw t;
}
} catch (IOException e) {
throw new TTransportException(e);
}
}
use of org.apache.thrift.transport.TTransport in project eiger by wlloyd.
the class WordCountSetup method createConnection.
private static Cassandra.Client createConnection(String host, Integer port, boolean framed) throws TTransportException {
TSocket socket = new TSocket(host, port);
TTransport trans = framed ? new TFramedTransport(socket) : socket;
trans.open();
TProtocol protocol = new TBinaryProtocol(trans);
return new Cassandra.Client(protocol);
}
Aggregations