use of java.net.SocketAddress in project pinpoint by naver.
the class TAsyncMethodCallConstructInterceptor method after.
@Override
public void after(Object target, Object[] args, Object result, Throwable throwable) {
if (isDebug) {
logger.afterInterceptor(target, args, result, throwable);
}
if (validate(target)) {
TNonblockingTransport transport = ((TNonblockingTransportFieldGetter) target)._$PINPOINT$_getTNonblockingTransport();
if (validateTransport(transport)) {
SocketAddress socketAddress = ((SocketAddressFieldAccessor) transport)._$PINPOINT$_getSocketAddress();
((SocketAddressFieldAccessor) target)._$PINPOINT$_setSocketAddress(socketAddress);
}
}
}
use of java.net.SocketAddress in project pinpoint by naver.
the class NetworkAvailabilityCheckPacketFilterTest method testFilter_Continue.
@Test
public void testFilter_Continue() throws Exception {
SocketAddress localSocketAddress = senderSocket.getLocalSocketAddress();
logger.debug("localSocket:{}", localSocketAddress);
TSpan skip = new TSpan();
boolean skipResult = filter.filter(receiverSocket, skip, null);
Assert.assertEquals(skipResult, TBaseFilter.CONTINUE);
}
use of java.net.SocketAddress in project pinpoint by naver.
the class NetworkAvailabilityCheckPacketFilterTest method testFilter.
@Test
public void testFilter() throws Exception {
SocketAddress localSocketAddress = senderSocket.getLocalSocketAddress();
logger.debug("localSocket:{}", localSocketAddress);
NetworkAvailabilityCheckPacket packet = new NetworkAvailabilityCheckPacket();
boolean skipResult = filter.filter(receiverSocket, packet, new InetSocketAddress("localhost", senderSocket.getLocalPort()));
Assert.assertEquals(skipResult, TBaseFilter.BREAK);
DatagramPacket receivePacket = new DatagramPacket(new byte[100], 100);
senderSocket.receive(receivePacket);
Assert.assertEquals(receivePacket.getLength(), NetworkAvailabilityCheckPacket.DATA_OK.length);
Assert.assertArrayEquals(Arrays.copyOf(receivePacket.getData(), NetworkAvailabilityCheckPacket.DATA_OK.length), NetworkAvailabilityCheckPacket.DATA_OK);
}
use of java.net.SocketAddress in project aws-iam-ldap-bridge by denismo.
the class AWSIAMAuthenticator method authenticate.
@Override
public LdapPrincipal authenticate(BindOperationContext bindContext) throws Exception {
if (!isAWSAccount(bindContext) || disabled) {
LOG.debug("Skipping " + bindContext.getDn() + " - not an AWS account");
if (delegatedAuth == null) {
LOG.error("Delegated auth is null");
return null;
}
return delegatedAuth.authenticate(bindContext);
}
LOG.debug("Authenticating " + bindContext.getDn());
byte[] password = bindContext.getCredentials();
LookupOperationContext lookupContext = new LookupOperationContext(getDirectoryService().getAdminSession(), bindContext.getDn(), SchemaConstants.ALL_USER_ATTRIBUTES, SchemaConstants.ALL_OPERATIONAL_ATTRIBUTES);
Entry userEntry = getDirectoryService().getPartitionNexus().lookup(lookupContext);
if (validator.verifyIAMPassword(userEntry, new String(password))) {
LdapPrincipal principal = new LdapPrincipal(getDirectoryService().getSchemaManager(), bindContext.getDn(), AuthenticationLevel.SIMPLE, password);
IoSession session = bindContext.getIoSession();
if (session != null) {
SocketAddress clientAddress = session.getRemoteAddress();
principal.setClientAddress(clientAddress);
SocketAddress serverAddress = session.getServiceAddress();
principal.setServerAddress(serverAddress);
}
bindContext.setEntry(new ClonedServerEntry(userEntry));
return principal;
} else {
// Bad password ...
String message = I18n.err(I18n.ERR_230, bindContext.getDn().getName());
LOG.info(message);
throw new LdapAuthenticationException(message);
}
}
use of java.net.SocketAddress in project dropwizard by dropwizard.
the class JerseyClientBuilderTest method usesACustomHttpRoutePlanner.
@Test
public void usesACustomHttpRoutePlanner() {
final HttpRoutePlanner customHttpRoutePlanner = new SystemDefaultRoutePlanner(new ProxySelector() {
@Override
public List<Proxy> select(URI uri) {
return ImmutableList.of(new Proxy(Proxy.Type.HTTP, new InetSocketAddress("192.168.53.12", 8080)));
}
@Override
public void connectFailed(URI uri, SocketAddress sa, IOException ioe) {
}
});
builder.using(customHttpRoutePlanner);
verify(apacheHttpClientBuilder).using(customHttpRoutePlanner);
}
Aggregations